Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mangasee] add support for 'mangalife' #3086

Merged
merged 2 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Chapters, Manga</td>
<td></td>
</tr>
<tr>
<td>MangaLife</td>
<td>https://manga4life.com/</td>
<td>Chapters, Manga</td>
<td></td>
</tr>
<tr>
<td>Manganato</td>
<td>https://manganato.com/</td>
Expand Down
94 changes: 66 additions & 28 deletions gallery_dl/extractor/mangasee.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,59 @@ def _transform_chapter(data):


class MangaseeChapterExtractor(MangaseeBase, ChapterExtractor):
pattern = r"(?:https?://)?mangasee123\.com(/read-online/[^/?#]+\.html)"
test = (("https://mangasee123.com/read-online"
"/Tokyo-Innocent-chapter-4.5-page-1.html"), {
"pattern": r"https://[^/]+/manga/Tokyo-Innocent/0004\.5-00\d\.png",
"count": 8,
"keyword": {
"chapter": 4,
"chapter_minor": ".5",
"chapter_string": "100045",
pattern = (r"(?:https?://)?(mangasee123|manga4life)\.com"
r"(/read-online/[^/?#]+\.html)")
test = (
(("https://mangasee123.com/read-online"
"/Tokyo-Innocent-chapter-4.5-page-1.html"), {
"pattern": r"https://[^/]+/manga/Tokyo-Innocent/0004\.5-00\d\.png",
"count": 8,
"date": "dt:2020-01-20 21:52:53",
"extension": "png",
"filename": r"re:0004\.5-00\d",
"index": "1",
"lang": "en",
"language": "English",
"manga": "Tokyo Innocent",
"page": int,
"title": "",
},
})
"keyword": {
"chapter": 4,
"chapter_minor": ".5",
"chapter_string": "100045",
"count": 8,
"date": "dt:2020-01-20 21:52:53",
"extension": "png",
"filename": r"re:0004\.5-00\d",
"index": "1",
"lang": "en",
"language": "English",
"manga": "Tokyo Innocent",
"page": int,
"title": "",
},
}),
(("https://manga4life.com/read-online"
"/One-Piece-chapter-1063-page-1.html"), {
"pattern": r"https://[^/]+/manga/One-Piece/1063-0\d\d\.png",
"count": 13,
"keyword": {
"chapter": 1063,
"chapter_minor": "",
"chapter_string": "110630",
"count": 13,
"date": "dt:2022-10-16 17:32:54",
"extension": "png",
"filename": r"re:1063-0\d\d",
"index": "1",
"lang": "en",
"language": "English",
"manga": "One Piece",
"page": int,
"title": "",
},
}),
)

def __init__(self, match):
ChapterExtractor.__init__(self, match)
if match.group(1) == "manga4life":
self.category = "mangalife"
self.root = "https://manga4life.com"
ChapterExtractor.__init__(self, match, self.root + match.group(2))
self.session.headers["Referer"] = self.gallery_url

domain = "mangasee123.com"
domain = self.root.rpartition("/")[2]
cookies = self.session.cookies
if not cookies.get("PHPSESSID", domain=domain):
cookies.set("PHPSESSID", util.generate_token(13), domain=domain)
Expand Down Expand Up @@ -96,12 +122,24 @@ def images(self, page):

class MangaseeMangaExtractor(MangaseeBase, MangaExtractor):
chapterclass = MangaseeChapterExtractor
pattern = r"(?:https?://)?mangasee123\.com(/manga/[^/?#]+)"
test = (("https://mangasee123.com/manga"
"/Nakamura-Koedo-To-Daizu-Keisuke-Wa-Umaku-Ikanai"), {
"pattern": MangaseeChapterExtractor.pattern,
"count": ">= 17",
})
pattern = r"(?:https?://)?(mangasee123|manga4life)\.com(/manga/[^/?#]+)"
test = (
(("https://mangasee123.com/manga"
"/Nakamura-Koedo-To-Daizu-Keisuke-Wa-Umaku-Ikanai"), {
"pattern": MangaseeChapterExtractor.pattern,
"count": ">= 17",
}),
("https://manga4life.com/manga/Ano-Musume-Ni-Kiss-To-Shirayuri-O", {
"pattern": MangaseeChapterExtractor.pattern,
"count": ">= 50",
}),
)

def __init__(self, match):
if match.group(1) == "manga4life":
self.category = "mangalife"
self.root = "https://manga4life.com"
MangaExtractor.__init__(self, match, self.root + match.group(2))

def chapters(self, page):
slug, pos = text.extract(page, 'vm.IndexName = "', '"')
Expand Down
5 changes: 5 additions & 0 deletions scripts/supportedsites.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"mangafox" : "Manga Fox",
"mangahere" : "Manga Here",
"mangakakalot" : "MangaKakalot",
"mangalife" : "MangaLife",
"manganelo" : "Manganato",
"mangapark" : "MangaPark",
"mangasee" : "MangaSee",
Expand Down Expand Up @@ -425,6 +426,10 @@ def build_extractor_list():
default["pornimagesxxx"] = default["hentaicosplays"]
domains["pornimagesxxx"] = "https://porn-images-xxx.com/"

# add manga4life.com
default["mangalife"] = default["mangasee"]
domains["mangalife"] = "https://manga4life.com/"

return categories, domains


Expand Down