From 5aa55def00fa1c32604cfb028d3ddb7a90b6bfaa Mon Sep 17 00:00:00 2001 From: nonjosh Date: Sat, 21 Dec 2024 21:50:29 +0800 Subject: [PATCH 1/3] add JmangaChecker --- helpers/checkers/__init__.py | 2 ++ helpers/checkers/jmanga.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 helpers/checkers/jmanga.py diff --git a/helpers/checkers/__init__.py b/helpers/checkers/__init__.py index 9e925c2..c23534a 100644 --- a/helpers/checkers/__init__.py +++ b/helpers/checkers/__init__.py @@ -8,6 +8,7 @@ from helpers.checkers.base import AbstractChapterChecker from helpers.checkers.biqu import BiquChecker from helpers.checkers.dashuhuwai import DashumanhuaChecker +from helpers.checkers.jmanga import JmangaChecker from helpers.checkers.klmanaga import KlmanagaChecker from helpers.checkers.kunmanga import KunmangaChecker from helpers.checkers.laimanhua import LaimanhuaChecker @@ -36,6 +37,7 @@ XbiqugeChecker, KlmanagaChecker, KunmangaChecker, + JmangaChecker, WeixinChecker, LaimanhuaChecker, ] diff --git a/helpers/checkers/jmanga.py b/helpers/checkers/jmanga.py new file mode 100644 index 0000000..69b4623 --- /dev/null +++ b/helpers/checkers/jmanga.py @@ -0,0 +1,30 @@ +from typing import List + +from bs4.element import ResultSet, Tag + +from helpers.chapter import Chapter +from helpers.checkers.base import AbstractChapterChecker + + +class JmangaChecker(AbstractChapterChecker): + """Kunmanga checker""" + + URL_SUBSTRING = "jmanga" + + def get_latest_chapter_list(self) -> List[Chapter]: + """Get latest chapter list from Jmanga + + Returns: + List[Chapter]: latest chapter list + """ + soup = self.get_latest_soup() + if soup is None: + return [] + a_list: ResultSet[Tag] = soup.find_all("a", {"class": "item-link"}) + chapter_list = [] + for chapter_tag in a_list: + chapter_title = chapter_tag.text.strip() + chapter_url = chapter_tag["href"] + chapter_list.append(Chapter(title=chapter_title, url=chapter_url)) + + return chapter_list[::-1] From de0ff463cea76a95e56bc02a20be2d6a4cf24640 Mon Sep 17 00:00:00 2001 From: nonjosh Date: Sat, 21 Dec 2024 21:50:33 +0800 Subject: [PATCH 2/3] add unit test --- tests/test_checkers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_checkers.py b/tests/test_checkers.py index 4c4cea7..098f892 100644 --- a/tests/test_checkers.py +++ b/tests/test_checkers.py @@ -139,6 +139,13 @@ def test_kunmanga_checker(self) -> None: check_url="https://kunmanga.com/manga/sss-class-suicide-hunter/", ) + def test_jmanga_checker(self) -> None: + """jmanga""" + self.universal_checking( + test_checker=checkers.JmangaChecker, + check_url="https://jmanga.so/read/%E3%83%A4%E3%83%B3%E3%83%87%E3%83%AC%E9%AD%94%E6%B3%95%E4%BD%BF%E3%81%84%E3%81%AF%E7%9F%B3%E5%83%8F%E3%81%AE%E4%B9%99%E5%A5%B3%E3%81%97%E3%81%8B%E6%84%9B%E3%81%9B%E3%81%AA%E3%81%84-%E9%AD%94%E5%A5%B3%E3%81%AF%E6%84%9B%E5%BC%9F%E5%AD%90%E3%81%AE%E7%86%B1%E3%81%84%E5%8F%A3%E3%81%A5%E3%81%91%E3%81%A7%E3%81%A8%E3%81%91%E3%82%8B-raw/", + ) + def test_weixin_checker(self) -> None: """Weixin""" self.universal_checking( From 2597449de4cfa77540e10e7a02ecf24c4e822191 Mon Sep 17 00:00:00 2001 From: nonjosh Date: Sat, 21 Dec 2024 21:57:07 +0800 Subject: [PATCH 3/3] update README --- README.md | 65 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 0e801c1..bc9c0d3 100644 --- a/README.md +++ b/README.md @@ -5,20 +5,20 @@ ![unittest workflow](https://github.com/nonjosh/acgn-bot/actions/workflows/python-test.yml/badge.svg) ![CodeQL workflow](https://github.com/nonjosh/acgn-bot/actions/workflows/codeql-analysis.yml/badge.svg) -- [Telegram bot: Check anime/comic/game/novel websites update](#telegram-bot-check-animecomicgamenovel-websites-update) - - [Introduction](#introduction) - - [Screenshots](#screenshots) - - [Supported websites](#supported-websites) - - [Default Settings](#default-settings) - - [Supported Telegram Commands](#supported-telegram-commands) - - [Environment Variables](#environment-variables) - - [How to use](#how-to-use) - - [Setup](#setup) - - [Option 1: Python](#option-1-python) - - [Option 2: Docker Compose](#option-2-docker-compose) - - [Option 3: Kubernetes](#option-3-kubernetes) - - [Edit your list](#edit-your-list) - - [Features to add](#features-to-add) +- [Telegram bot: Check anime/comic/game/novel websites update](#telegram-bot-check-animecomicgamenovel-websites-update) + - [Introduction](#introduction) + - [Screenshots](#screenshots) + - [Supported websites](#supported-websites) + - [Default Settings](#default-settings) + - [Supported Telegram Commands](#supported-telegram-commands) + - [Environment Variables](#environment-variables) + - [How to use](#how-to-use) + - [Setup](#setup) + - [Option 1: Python](#option-1-python) + - [Option 2: Docker Compose](#option-2-docker-compose) + - [Option 3: Kubernetes](#option-3-kubernetes) + - [Edit your list](#edit-your-list) + - [Features to add](#features-to-add) ## Introduction @@ -31,21 +31,22 @@ This bot scans anime/comic/game/novel websites, and send telegram message to spe ### Supported websites -| Name | Example Url | Media Type | -| ---------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------- | -| syosetu | | novel | -| piaotian | | novel | -| 69shu | | novel | -| biqu | | novel | -| manhuagui | | comic | -| qimanhu | | comic | -| baozimh | | comic | -| xbiquge | | comic | -| dashuhuwai | | comic | -| mn4u | | comic | -| klmanga | | comic | -| laimanhua | | comic | -| weixin | | others | +| Name | Example Url | Media Type | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| syosetu | | novel | +| piaotian | | novel | +| 69shu | | novel | +| biqu | | novel | +| manhuagui | | comic | +| qimanhu | | comic | +| baozimh | | comic | +| xbiquge | | comic | +| dashuhuwai | | comic | +| mn4u | | comic | +| klmanga | | comic | +| jmanga | | comic | +| laimanhua | | comic | +| weixin | | others | ### Default Settings @@ -137,6 +138,6 @@ Edit your list in the file `list.yaml`. Restart container to apply changes. ## Features to add -- hack cocomanhua cloudflare DDOS protection -- Support other IM bot other than Telegram (e.g. Signal, Discord) -- Add back time range for checking +- hack cocomanhua cloudflare DDOS protection +- Support other IM bot other than Telegram (e.g. Signal, Discord) +- Add back time range for checking