From 225e47328cfef79cb698d7538fb533740f54ebb4 Mon Sep 17 00:00:00 2001 From: pfych Date: Tue, 24 Sep 2024 15:52:05 +1000 Subject: [PATCH] Script for checking new manga chapters --- .config/scripts/cron/check-manga.sh | 27 +++++++++++++++++++++++++++ .config/webhook | 6 ++++++ 2 files changed, 33 insertions(+) create mode 100755 .config/scripts/cron/check-manga.sh diff --git a/.config/scripts/cron/check-manga.sh b/.config/scripts/cron/check-manga.sh new file mode 100755 index 0000000..d2763f1 --- /dev/null +++ b/.config/scripts/cron/check-manga.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +BASE="https://fanfox.net/manga" +declare -a TO_CHECK=( + "the_guy_she_was_interested_in_wasn_t_a_guy_at_all|The Guy She Was Interested In Wasn't A Guy At All" +) + +for MANGA in "${TO_CHECK[@]}" +do + URL=$(echo $MANGA | cut -d "|" -f1) + PRETTY_NAME=$(echo $MANGA | cut -d "|" -f2) + + LAST_CHAPTER=$(cat "/tmp/$URL.txt"); + LATEST_CHAPTER=$(curl "$BASE/$URL/" \ + --cookie "isAdult=1" \ + | perl -ne 'm|detail-main-list">(.\|\n)*?title3">(.*?)<\/p>| && print "$2"' + ) + + if [ ! -f "/tmp/$MANGA.txt" ] && [[ "$LATEST_CHAPTER" != "$LAST_CHAPTER" ]]; then + /Users/noahheague/.config/scripts/util/webhook.sh \ + -c "manga" \ + -m "New chapter of $PRETTY_NAME ($LATEST_CHAPTER)" + fi + + echo $LATEST_CHAPTER > "/tmp/$URL.txt"; +done + diff --git a/.config/webhook b/.config/webhook index 5664595..3d452ba 100644 --- a/.config/webhook +++ b/.config/webhook @@ -22,3 +22,9 @@ PIC="https://assets.pfy.ch/icons/route53.png" NAME="Coles" ENDPOINT="$(getSecret '/server/mac-mini-1/webhook-url')" PIC="https://aseets.pfy.ch/icons/coles.png" + +[manga] +NAME="Manga" +ENDPOINT="$(getSecret '/server/mac-mini-1/webhook-url')" +PIC="https://aseets.pfy.ch/icons/manga.png" +