Skip to content

Commit

Permalink
Merge branch 'feature/jmanga' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nonjosh committed Dec 21, 2024
2 parents 27ca53b + 2597449 commit c5a12ef
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 32 deletions.
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 | <https://ncode.syosetu.com/n6621fl> | novel |
| piaotian | <https://www.piaotia.com/html/14/14565/> | novel |
| 69shu | <https://www.69shu.com/2108/> | novel |
| biqu | <http://m.biqu520.net/wapbook-147321/> | novel |
| manhuagui | <https://m.manhuagui.com/comic/30903/> | comic |
| qimanhu | <http://m.qmanwu2.com/12235/> | comic |
| baozimh | <https://www.baozimh.com/comic/fangkainagenuwu-yuewenmanhua_e> | comic |
| xbiquge | <https://www.xbiquge.so/book/53099/> | comic |
| dashuhuwai | <https://www.dashuhuwai.com/comic/fangkainagenvwu/> | comic |
| mn4u | <https://mn4u.net/zgm-2149/> | comic |
| klmanga | <https://mangakl.su/one-piece-raw-1058> | comic |
| laimanhua | <https://www.laimanhua8.com/kanmanhua/quanzhiduzheshijiao/> | comic |
| weixin | <https://mp.weixin.qq.com/mp/appmsgalbum?action=getalbum&album_id=2989381295912878080&__biz=MzI5MjMwNjQxMw==#wechat_redirect> | others |
| Name | Example Url | Media Type |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| syosetu | <https://ncode.syosetu.com/n6621fl> | novel |
| piaotian | <https://www.piaotia.com/html/14/14565/> | novel |
| 69shu | <https://www.69shu.com/2108/> | novel |
| biqu | <http://m.biqu520.net/wapbook-147321/> | novel |
| manhuagui | <https://m.manhuagui.com/comic/30903/> | comic |
| qimanhu | <http://m.qmanwu2.com/12235/> | comic |
| baozimh | <https://www.baozimh.com/comic/fangkainagenuwu-yuewenmanhua_e> | comic |
| xbiquge | <https://www.xbiquge.so/book/53099/> | comic |
| dashuhuwai | <https://www.dashuhuwai.com/comic/fangkainagenvwu/> | comic |
| mn4u | <https://mn4u.net/zgm-2149/> | comic |
| klmanga | <https://mangakl.su/one-piece-raw-1058> | comic |
| jmanga | <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/> | comic |
| laimanhua | <https://www.laimanhua8.com/kanmanhua/quanzhiduzheshijiao/> | comic |
| weixin | <https://mp.weixin.qq.com/mp/appmsgalbum?action=getalbum&album_id=2989381295912878080&__biz=MzI5MjMwNjQxMw==#wechat_redirect> | others |

### Default Settings

Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions helpers/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -36,6 +37,7 @@
XbiqugeChecker,
KlmanagaChecker,
KunmangaChecker,
JmangaChecker,
WeixinChecker,
LaimanhuaChecker,
]
Expand Down
30 changes: 30 additions & 0 deletions helpers/checkers/jmanga.py
Original file line number Diff line number Diff line change
@@ -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]
7 changes: 7 additions & 0 deletions tests/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit c5a12ef

Please # to comment.