mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 20:22:36 +01:00
[hentaifox] fix extraction
This commit is contained in:
parent
e2710702d4
commit
004812258d
@ -23,8 +23,8 @@ class HentaifoxGalleryExtractor(HentaifoxBase, GalleryExtractor):
|
|||||||
pattern = r"(?:https?://)?(?:www\.)?hentaifox\.com(/gallery/(\d+))"
|
pattern = r"(?:https?://)?(?:www\.)?hentaifox\.com(/gallery/(\d+))"
|
||||||
test = ("https://hentaifox.com/gallery/56622/", {
|
test = ("https://hentaifox.com/gallery/56622/", {
|
||||||
"pattern": r"https://i\d*\.hentaifox\.com/\d+/\d+/\d+\.jpg",
|
"pattern": r"https://i\d*\.hentaifox\.com/\d+/\d+/\d+\.jpg",
|
||||||
|
"keyword": "b7ff141331d0c7fc711ab28d45dfbb013a83d8e9",
|
||||||
"count": 24,
|
"count": 24,
|
||||||
"keyword": "903ebe227d85e484460382fc6cbab42be7a244d5",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@ -37,19 +37,43 @@ class HentaifoxGalleryExtractor(HentaifoxBase, GalleryExtractor):
|
|||||||
return {
|
return {
|
||||||
"gallery_id": text.parse_int(self.gallery_id),
|
"gallery_id": text.parse_int(self.gallery_id),
|
||||||
"title" : text.unescape(extr("<h1>", "</h1>")),
|
"title" : text.unescape(extr("<h1>", "</h1>")),
|
||||||
"parody" : split(extr(">Parodies:" , "</a></span>"))[::2],
|
"parody" : split(extr(">Parodies:" , "</ul>"))[::2],
|
||||||
"characters": split(extr(">Characters:", "</a></span>"))[::2],
|
"characters": split(extr(">Characters:", "</ul>"))[::2],
|
||||||
"tags" : split(extr(">Tags:" , "</a></span>"))[::2],
|
"tags" : split(extr(">Tags:" , "</ul>"))[::2],
|
||||||
"artist" : split(extr(">Artists:" , "</a></span>"))[::2],
|
"artist" : split(extr(">Artists:" , "</ul>"))[::2],
|
||||||
"group" : split(extr(">Groups:" , "</a></span>"))[::2],
|
"group" : split(extr(">Groups:" , "</ul>"))[::2],
|
||||||
"type" : text.remove_html(extr(">Category:", "</a></span>")),
|
"type" : text.remove_html(extr(">Category:", "<span")),
|
||||||
"language" : "English",
|
"language" : "English",
|
||||||
"lang" : "en",
|
"lang" : "en",
|
||||||
}
|
}
|
||||||
|
|
||||||
def images(self, page):
|
def images(self, page):
|
||||||
|
pos = page.find('id="load_all"')
|
||||||
|
if pos >= 0:
|
||||||
|
extr = text.extract
|
||||||
|
load_id = extr(page, 'id="load_id" value="', '"', pos)[0]
|
||||||
|
load_dir = extr(page, 'id="load_dir" value="', '"', pos)[0]
|
||||||
|
load_pages = extr(page, 'id="load_pages" value="', '"', pos)[0]
|
||||||
|
|
||||||
|
url = self.root + "/includes/thumbs_loader.php"
|
||||||
|
data = {
|
||||||
|
"u_id" : self.gallery_id,
|
||||||
|
"g_id" : load_id,
|
||||||
|
"img_dir" : load_dir,
|
||||||
|
"visible_pages": "0",
|
||||||
|
"total_pages" : load_pages,
|
||||||
|
"type" : "2",
|
||||||
|
}
|
||||||
|
headers = {
|
||||||
|
"Origin": self.root,
|
||||||
|
"Referer": self.gallery_url,
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
}
|
||||||
|
page = self.request(
|
||||||
|
url, method="POST", headers=headers, data=data).text
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(text.urljoin(self.root, url.replace("t.", ".")), None)
|
(url.replace("t.", "."), None)
|
||||||
for url in text.extract_iter(page, 'data-src="', '"')
|
for url in text.extract_iter(page, 'data-src="', '"')
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -64,15 +88,13 @@ class HentaifoxSearchExtractor(HentaifoxBase, Extractor):
|
|||||||
("https://hentaifox.com/character/reimu-hakurei/"),
|
("https://hentaifox.com/character/reimu-hakurei/"),
|
||||||
("https://hentaifox.com/artist/distance/"),
|
("https://hentaifox.com/artist/distance/"),
|
||||||
("https://hentaifox.com/search/touhou/"),
|
("https://hentaifox.com/search/touhou/"),
|
||||||
("https://hentaifox.com/tag/full-colour/", {
|
("https://hentaifox.com/tag/heterochromia/", {
|
||||||
"pattern": HentaifoxGalleryExtractor.pattern,
|
"pattern": HentaifoxGalleryExtractor.pattern,
|
||||||
"count": ">= 40",
|
"count": ">= 60",
|
||||||
"keyword": {
|
"keyword": {
|
||||||
"url": str,
|
"url" : str,
|
||||||
"gallery_id": int,
|
"gallery_id": int,
|
||||||
"thumbnail": r"re:https://i\d*.hentaifox.com/\d+/\d+/thumb\.",
|
"title" : str,
|
||||||
"title": str,
|
|
||||||
"tags": list,
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@ -87,31 +109,26 @@ class HentaifoxSearchExtractor(HentaifoxBase, Extractor):
|
|||||||
yield Message.Queue, gallery["url"], gallery
|
yield Message.Queue, gallery["url"], gallery
|
||||||
|
|
||||||
def galleries(self):
|
def galleries(self):
|
||||||
url = "{}/{}/".format(self.root, self.path)
|
num = 1
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
url = "{}{}/pag/{}/".format(self.root, self.path, num)
|
||||||
page = self.request(url).text
|
page = self.request(url).text
|
||||||
info, gpos = text.extract(
|
|
||||||
page, 'class="galleries_overview">', 'class="clear">')
|
|
||||||
|
|
||||||
for ginfo in text.extract_iter(info, '<div class="item', '</a>'):
|
for info in text.extract_iter(
|
||||||
tags , pos = text.extract(ginfo, '', '"')
|
page, 'class="g_title"><a href="', '</a>'):
|
||||||
url , pos = text.extract(ginfo, 'href="', '"', pos)
|
url, _, title = info.partition('">')
|
||||||
title, pos = text.extract(ginfo, 'alt="', '"', pos)
|
|
||||||
thumb, pos = text.extract(ginfo, 'src="', '"', pos)
|
|
||||||
|
|
||||||
yield {
|
yield {
|
||||||
"url": text.urljoin(self.root, url),
|
"url" : text.urljoin(self.root, url),
|
||||||
"gallery_id": text.parse_int(
|
"gallery_id": text.parse_int(
|
||||||
url.strip("/").rpartition("/")[2]),
|
url.strip("/").rpartition("/")[2]),
|
||||||
"thumbnail": text.urljoin(self.root, thumb),
|
"title" : text.unescape(title),
|
||||||
"title": text.unescape(title),
|
|
||||||
"tags": tags.split(),
|
|
||||||
"_extractor": HentaifoxGalleryExtractor,
|
"_extractor": HentaifoxGalleryExtractor,
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = page.find('class="current"', gpos)
|
pos = page.find(">Next<")
|
||||||
url = text.extract(page, 'href="', '"', pos)[0]
|
url = text.rextract(page, "href=", ">", pos)[0]
|
||||||
if pos == -1 or "/pag" not in url:
|
if pos == -1 or "/pag" not in url:
|
||||||
return
|
return
|
||||||
url = text.urljoin(self.root, url)
|
num += 1
|
||||||
|
@ -26,7 +26,6 @@ TRAVIS_SKIP = {
|
|||||||
|
|
||||||
# temporary issues, etc.
|
# temporary issues, etc.
|
||||||
BROKEN = {
|
BROKEN = {
|
||||||
"hentaifox",
|
|
||||||
"mangapark",
|
"mangapark",
|
||||||
"pixhost",
|
"pixhost",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user