[dandadan] add support (#8381)
This commit is contained in:
@@ -223,6 +223,12 @@ Consider all listed sites to potentially be NSFW.
|
||||
<td>Files, Folders</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="dandadan" title="dandadan">
|
||||
<td>Dandadan</td>
|
||||
<td>https://dandadan.net/</td>
|
||||
<td>Chapters, Manga</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="dankefuerslesen" title="dankefuerslesen">
|
||||
<td>Danke fürs Lesen</td>
|
||||
<td>https://danke.moe/</td>
|
||||
|
||||
@@ -47,6 +47,7 @@ modules = [
|
||||
"cyberdrop",
|
||||
"cyberfile",
|
||||
"danbooru",
|
||||
"dandadan",
|
||||
"dankefuerslesen",
|
||||
"desktopography",
|
||||
"deviantart",
|
||||
|
||||
65
gallery_dl/extractor/dandadan.py
Normal file
65
gallery_dl/extractor/dandadan.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2025 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
"""Extractors for https://dandadan.net/"""
|
||||
|
||||
from .common import ChapterExtractor, MangaExtractor
|
||||
from .. import text
|
||||
|
||||
BASE_PATTERN = r"(?:https?://)?(?:www\.)?dandadan\.net"
|
||||
|
||||
|
||||
class DandadanBase():
|
||||
"""Base class for dandadan extractors"""
|
||||
category = "dandadan"
|
||||
root = "https://dandadan.net"
|
||||
|
||||
|
||||
class DandadanChapterExtractor(DandadanBase, ChapterExtractor):
|
||||
"""Extractor for dandadan manga chapters"""
|
||||
pattern = rf"{BASE_PATTERN}(/manga/dandadan-chapter-([^/?#]+)/?)"
|
||||
example = "https://dandadan.net/manga/dandadan-chapter-123/"
|
||||
|
||||
def metadata(self, page):
|
||||
chapter, sep, minor = text.extr(
|
||||
page, "hapter ", " - ").partition(".")
|
||||
return {
|
||||
"manga" : "Dandadan",
|
||||
"chapter" : text.parse_int(chapter),
|
||||
"chapter_minor": f"{sep}{minor}",
|
||||
"lang" : "en",
|
||||
}
|
||||
|
||||
def images(self, page):
|
||||
images = [
|
||||
(text.extr(figure, 'src="', '"'), None)
|
||||
for figure in text.extract_iter(page, "<figure", "</figure>")
|
||||
]
|
||||
|
||||
if images:
|
||||
return images
|
||||
|
||||
return [
|
||||
(src, None)
|
||||
for src in text.extract_iter(
|
||||
page, '<img decoding="async" class="aligncenter" src="', '"')
|
||||
]
|
||||
|
||||
|
||||
class DandadanMangaExtractor(DandadanBase, MangaExtractor):
|
||||
"""Extractor for dandadan manga"""
|
||||
chapterclass = DandadanChapterExtractor
|
||||
pattern = rf"{BASE_PATTERN}(/)"
|
||||
example = "https://dandadan.net/"
|
||||
|
||||
def chapters(self, page):
|
||||
data = {}
|
||||
return [
|
||||
(text.extr(post, 'href="', '"'), data)
|
||||
for post in text.extract_iter(page, '<li id="su-post', "</li>")
|
||||
]
|
||||
51
test/results/dandadan.py
Normal file
51
test/results/dandadan.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
from gallery_dl.extractor import dandadan
|
||||
|
||||
|
||||
__tests__ = (
|
||||
{
|
||||
"#url" : "https://dandadan.net/manga/dandadan-chapter-1/",
|
||||
"#class" : dandadan.DandadanChapterExtractor,
|
||||
"#pattern" : r"https://cdn\.readkakegurui\.com/file/cdnpog/dandadan/chapter\-1/\d+\.webp",
|
||||
"#count" : 67,
|
||||
|
||||
"chapter" : 1,
|
||||
"count" : 67,
|
||||
"page" : range(1, 67),
|
||||
"extension": "webp",
|
||||
"lang" : "en",
|
||||
"manga" : "Dandadan",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://dandadan.net/manga/dandadan-chapter-40-5-3/",
|
||||
"#class" : dandadan.DandadanChapterExtractor,
|
||||
"#pattern" : r"https://cdn\.readkakegurui\.com/file/cdnpog/dandadan/chapter\-40\.5/\d+\.webp",
|
||||
"#count" : 35,
|
||||
|
||||
"chapter" : 40,
|
||||
"chapter_minor": ".5",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://dandadan.net/manga/dandadan-chapter-203/",
|
||||
"#class" : dandadan.DandadanChapterExtractor,
|
||||
"#pattern" : r"https://pic\.readkakegurui\.com/file/sancdn/dandadan/chapter\-203/\d+\.webp",
|
||||
"#count" : 22,
|
||||
|
||||
"chapter": 203,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://dandadan.net/",
|
||||
"#class" : dandadan.DandadanMangaExtractor,
|
||||
"#pattern" : dandadan.DandadanChapterExtractor.pattern,
|
||||
"#count" : range(210, 300),
|
||||
},
|
||||
|
||||
)
|
||||
Reference in New Issue
Block a user