Skip to content

Commit

Permalink
merging from dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MooshiMochi committed Nov 25, 2024
2 parents 15695f3 + 9501a32 commit 499a74b
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .idea/sqldialects.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

#### Consider supporting me on [Patreon](https://patreon.com/mooshi69) or [Ko-Fi](https://ko-fi.com/mooshi69)!

## // November 25th 2024

### Bug Fixes:

- Fixed flamecomics website
- Added support for https://www.beyondtheataraxia.com/
- Fixed asura chapter links

## // November 12th 2024

- Added `View Bookmark` button to the `Mylast read chapter` button in the chapter update message.
Expand Down
20 changes: 20 additions & 0 deletions src/core/scanlators/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,27 @@ async def get_all_chapters(self, raw_url: str, current_page: int = 1, max_page:
return chapters


class _Flamecomics(BasicScanlator):
def _extract_chapters_from_html(self, text: str) -> list[Chapter]:
token_rx = re.compile(r"\"token\":\"(?P<id>[a-z\d]+)\"")
chapter_num_rx = re.compile(r"\"chapter\":\"(?P<num>(?:\d*[.])?\d+)\"")
series_id_rx = re.compile(r"\"series_id\":(?P<id>\d+)")
url_base = self.json_tree.properties.base_url + "/series/"
series_id = series_id_rx.search(text).group("id")
url_base += series_id + "/"

found_chapters: list[Chapter] = []
for i, (name_match, token_match) in enumerate(
reversed(list(zip(chapter_num_rx.finditer(text), token_rx.finditer(text))))):
url = url_base + token_match.group("id")
name = name_match.group("num")
found_chapters.append(Chapter(url, name, i))
return found_chapters


class CustomKeys:
reaperscans: str = "reaperscans"
flamecomics: str = "flamecomics"
omegascans: str = "omegascans"
novelmic: str = "novelmic"
mangapark: str = "mangapark"
Expand All @@ -288,6 +307,7 @@ class CustomKeys:
keys = CustomKeys()

scanlators[keys.reaperscans] = _ReaperScans(keys.reaperscans, **scanlators[keys.reaperscans]) # noqa: This is a dict
scanlators[keys.flamecomics] = _Flamecomics(keys.flamecomics, **scanlators[keys.flamecomics]) # noqa: This is a dict
scanlators[keys.omegascans] = _OmegaScans(keys.omegascans, **scanlators[keys.omegascans]) # noqa: This is a dict
scanlators[keys.novelmic] = _NovelMic(keys.novelmic, **scanlators[keys.novelmic]) # noqa: This is a dict
scanlators[keys.mangapark] = _Mangapark(keys.mangapark, **scanlators[keys.mangapark]) # noqa: This is a dict
Expand Down
129 changes: 64 additions & 65 deletions src/core/scanlators/lookup_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,67 +294,6 @@
"request_method": "GET"
}
},
"flamecomics": {
"chapter_ajax": null,
"request_method": "http",
"url_regex": "(?:https?://)?(?:www\\.)?flamecomics\\.xyz/(?:series/)?(?P<url_name>\\w[\\w-]*?)(?:-chapter-[\\d.-]+(?:(-\\w+)?))?/?(?:/.*)?$",
"properties": {
"base_url": "https://flamecomics.xyz",
"icon_url": "https://flamecomics.xyz/wp-content/uploads/2021/03/cropped-fds-1.png",
"format_urls": {
"manga": "https://flamecomics.xyz/series/{url_name}/"
},
"latest_updates_url": "https://flamecomics.xyz/",
"dynamicURL": false,
"url_chapter_prefix": null
},
"selectors": {
"title": [
"h1.entry-title"
],
"synopsis": "div.wd-full > div.entry-content[itemprop=description] > p:first-child",
"cover": [
"div.thumb-half > div.thumb > img",
"[property=og\\:image]"
],
"chapters": {
"container": "li[data-num]",
"name": "span.chapternum",
"url": "a"
},
"status": [
"div.imptdt > h1:-soup-contains(\"Status\") + i"
],
"front_page": {
"container": "div.latest-updates > div > div.bsx",
"chapters": {
"container": "div.chapter-list > a:not(a[title])",
"name": "div.epxs",
"url": "_container_"
},
"title": "div.info > a > div",
"url": "div.info > a",
"cover": "a > div > img"
},
"unwanted_tags": [],
"search": {
"container": "div.bsx",
"title": "div.tt",
"url": "a",
"cover": "img"
}
},
"search": {
"search_param_name": "s",
"url": "https://flamecomics.xyz",
"as_type": "param",
"query_parsing": {
"encoding": "url"
},
"extra_params": {},
"request_method": "GET"
}
},
"asura": {
"chapter_ajax": null,
"request_method": "curl",
Expand Down Expand Up @@ -557,13 +496,13 @@
"nitroscans": {
"chapter_ajax": "html",
"request_method": "http",
"url_regex": "(?:https?://)?(?:www\\.)?nitroscans\\.net/mangas/(?P<url_name>[\\w-]+)(?:/.*)?",
"url_regex": "(?:https?://)?(?:www\\.)?nitroscans\\.net/series/(?P<url_name>[\\w-]+)(?:/.*)?",
"properties": {
"base_url": "https://nitroscans.net",
"icon_url": "https://nitroscans.net/wp-content/uploads/2023/08/YT-Logo-1.png",
"format_urls": {
"ajax": "https://nitroscans.net/mangas/{url_name}/ajax/chapters",
"manga": "https://nitroscans.net/mangas/{url_name}/"
"ajax": "https://nitroscans.net/series/{url_name}/ajax/chapters",
"manga": "https://nitroscans.net/series/{url_name}/"
},
"latest_updates_url": "https://nitroscans.net/",
"dynamicURL": false,
Expand Down Expand Up @@ -1346,7 +1285,7 @@
"ul > li[data-num]:first-child a > span.chapterdate"
],
"front_page": {
"container": "div.postbody > div.bixbox > div.listupd > div.bs > div.bsx",
"container": "div.listupd > div.bs > div.bsx",
"chapters": {
"container": "ul > li",
"name": "a",
Expand Down Expand Up @@ -2691,6 +2630,66 @@
},
"request_method": "POST"
}
},
"flamecomics": {
"chapter_ajax": null,
"request_method": "http",
"url_regex": "(?:https?://)?(?:www\\.)?flamecomics\\.xyz/(?:series/)?(?P<url_name>\\w[\\w-]*?)(?:-chapter-[\\d.-]+(?:(-\\w+)?))?/?(?:/.*)?$",
"properties": {
"base_url": "https://flamecomics.xyz",
"icon_url": "https://flamecomics.xyz/favicon.ico",
"format_urls": {
"manga": "https://flamecomics.xyz/series/{url_name}/"
},
"latest_updates_url": "https://flamecomics.xyz/",
"dynamicURL": false,
"url_chapter_prefix": null
},
"selectors": {
"title": [
"h1.mantine-Title-root"
],
"synopsis": "div[style=\"transition: 600ms;\"] p.mantine-Text-root",
"cover": [
"img[alt=Cover]"
],
"chapters": {
"container": "div.m_c0783ff9 a",
"name": "div.mantine-Stack-root > p:first-child",
"url": "_container_"
},
"status": [
"div.mantine-Badge-root > span.mantine-Badge-label"
],
"front_page": {
"container": "div.mantine-Container-root:has(h2) > div:last-child > div > div",
"chapters": {
"container": "a.m_b6d8b162:not([style])",
"name": "p.mantine-Text-root:first-child",
"url": "_container_"
},
"title": "a.mantine-Text-root:first-child[style]",
"url": "a.mantine-Text-root:first-child[style]",
"cover": "img"
},
"unwanted_tags": [],
"search": {
"container": "div.DescSeriesCard_cardContainer__CpvGh",
"title": "a.DescSeriesCard_title__q8Xt7:nth-child(2)",
"url": "a.DescSeriesCard_title__q8Xt7:nth-child(2)",
"cover": "img"
}
},
"search": {
"search_param_name": "search",
"url": "https://flamecomics.xyz/browse",
"as_type": "param",
"query_parsing": {
"encoding": "raw"
},
"extra_params": {},
"request_method": "GET"
}
}
}
}
9 changes: 6 additions & 3 deletions tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ async def first_chapter_url(self) -> bool:

async def cover_image(self) -> bool:
result = await self.test_subject.get_cover(self.fmt_url)
result = result.split("?")[0].rstrip("/") # remove URL params
# result = result.split("?")[0].rstrip("/") # remove URL params
evaluated: bool = result == self.expected_result.cover_image
if not evaluated:
print(f"Expected: {self.expected_result.cover_image}")
Expand Down Expand Up @@ -492,6 +492,9 @@ async def main():
# Support ended:
"epsilonscansoft", "epsilonscan",

# currently broken, need to fix.
"flamecomics",

"resetscans", # the website added pagination for chapters. need to hard-code custom scanlator class
"suryatoon", # renamed to genztoons.com, will add as new scanlator if no dataabse entries from it exist
"demonreader", # Need to work on figuring out the ID for the chapter. It might need custom implementation
Expand Down Expand Up @@ -591,7 +594,7 @@ async def test_single_scanlator(scanlator: str):
asyncio.run(main())
else:
# asyncio.run(test_single_method("show_front_page_results", "epsilonscans"))
asyncio.run(test_single_scanlator("asura"))
# asyncio.run(test_single_scanlator("flamecomics"))
# asyncio.run(sub_main())
# asyncio.run(paused_test())
# asyncio.run(main())
asyncio.run(main())
38 changes: 19 additions & 19 deletions tests/test_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@
}
},
"flamecomics": {
"user_input_url": "https://flamecomics.xyz/series/the-villainess-is-a-marionette/",
"user_input_url": "https://flamecomics.xyz/series/8",
"expected_results": {
"scanlator_name": "flamecomics",
"manga_url": "https://flamecomics.xyz/series/the-villainess-is-a-marionette/",
"manga_url": "https://flamecomics.xyz/series/8",
"completed": true,
"title": "The Villainess is a Marionette",
"manga_id": "https://flamecomics.¬xyz/series/the-villainess-is-a-marionette",
"curr_chapter_url": "https://flamecomics.xyz/the-villainess-is-a-marionette-chapter-69/",
"first_chapter_url": "https://flamecomics.xyz/the-villainess-is-a-marionette-chapter-0/",
"cover_image": "https://flamecomics.xyz/wp-content/uploads/2021/02/VIAM_S2_COVER.jpg",
"manga_id": "https://flamecomics.xyz/series/8",
"curr_chapter_url": "https://flamecomics.xyz/series/8/216edb7b2af67148",
"first_chapter_url": "https://flamecomics.xyz/series/8/61bc5405b22d34ef",
"cover_image": "https://flamecomics.xyz/_next/image?url=https%3A%2F%2Fcdn.flamecomics.xyz%2Fseries%2F8%2Fthumbnail.jpg&w=1920&q=100",
"last_3_chapter_urls": [
"https://flamecomics.xyz/the-villainess-is-a-marionette-chapter-67/",
"https://flamecomics.xyz/the-villainess-is-a-marionette-chapter-68/",
"https://flamecomics.xyz/the-villainess-is-a-marionette-chapter-69/"
"https://flamecomics.xyz/series/8/9ae0f9e2ae08e6aa",
"https://flamecomics.xyz/series/8/7c71f717e554864a",
"https://flamecomics.xyz/series/8/216edb7b2af67148"
],
"use_default_id_function": true,
"has_fp_manhwa": true
Expand Down Expand Up @@ -240,19 +240,19 @@
}
},
"nitroscans": {
"user_input_url": "https://nitroscans.net/mangas/i-grow-stronger-by-eating/",
"user_input_url": "https://nitroscans.net/series/i-grow-stronger-by-eating/",
"expected_results": {
"completed": false,
"cover_image": "https://nitroscans.net/wp-content/uploads/2023/03/I-Grow-Stronger-By-Eating.jpg",
"curr_chapter_url": "https://nitroscans.net/mangas/i-grow-stronger-by-eating/chapter-100/",
"first_chapter_url": "https://nitroscans.net/mangas/i-grow-stronger-by-eating/chapter/",
"curr_chapter_url": "https://nitroscans.net/series/i-grow-stronger-by-eating/chapter-100/",
"first_chapter_url": "https://nitroscans.net/series/i-grow-stronger-by-eating/chapter/",
"last_3_chapter_urls": [
"https://nitroscans.net/mangas/i-grow-stronger-by-eating/chapter-98/",
"https://nitroscans.net/mangas/i-grow-stronger-by-eating/chapter-99/",
"https://nitroscans.net/mangas/i-grow-stronger-by-eating/chapter-100/"
"https://nitroscans.net/series/i-grow-stronger-by-eating/chapter-98/",
"https://nitroscans.net/series/i-grow-stronger-by-eating/chapter-99/",
"https://nitroscans.net/series/i-grow-stronger-by-eating/chapter-100/"
],
"manga_id": "https://nitroscans.net/mangas/i-grow-stronger-by-eating",
"manga_url": "https://nitroscans.net/mangas/i-grow-stronger-by-eating/",
"manga_id": "https://nitroscans.net/series/i-grow-stronger-by-eating",
"manga_url": "https://nitroscans.net/series/i-grow-stronger-by-eating/",
"scanlator_name": "nitroscans",
"title": "I Grow Stronger By Eating!",
"use_default_id_function": true,
Expand Down Expand Up @@ -283,7 +283,7 @@
"user_input_url": "https://bato.to/title/95400-queen-in-the-shadows",
"expected_results": {
"completed": true,
"cover_image": "https://n15.ellie.wiki/thumb/W600/ampi/515/5153a1fcfcfd904decc8777384a7e5511c195a09_400_600_65091.jpeg",
"cover_image": "https://b01.mbtmv.org/thumb/W600/ampi/515/5153a1fcfcfd904decc8777384a7e5511c195a09_400_600_65091.jpeg",
"curr_chapter_url": "https://bato.to/title/95400-queen-in-the-shadows/2031007-ch_60",
"first_chapter_url": "https://bato.to/title/95400-queen-in-the-shadows/1803219-ch_1",
"last_3_chapter_urls": [
Expand Down Expand Up @@ -550,7 +550,7 @@
"use_default_id_function": false,
"curr_chapter_url": "https://mangapark.net/title/120626-en-machida-kun-no-sekai/1554480-vol-7-ch-27",
"first_chapter_url": "https://mangapark.net/title/120626-en-machida-kun-no-sekai/1554453-vol-1-ch-1",
"cover_image": "https://n01.eminence.pics/thumb/W600/amim/917/60910ca5adc9c575545dd719_300_450_50681.jpg",
"cover_image": "https://s01.mprnm.org/thumb/W600/amim/917/60910ca5adc9c575545dd719_300_450_50681.jpg",
"last_3_chapter_urls": [
"https://mangapark.net/title/120626-en-machida-kun-no-sekai/1554478-vol-7-ch-25",
"https://mangapark.net/title/120626-en-machida-kun-no-sekai/1554479-vol-7-ch-26",
Expand Down

0 comments on commit 499a74b

Please sign in to comment.