mirror of
https://github.com/mikf/gallery-dl.git
synced 2025-02-01 03:51:42 +01:00
[hentaibox] add extractor
This commit is contained in:
parent
b0ea9021dc
commit
3e8f70188f
@ -44,15 +44,15 @@ Supported Sites
|
||||
powermanga.org, raw.senmanga.com, thespectrum.net
|
||||
* Hentai:
|
||||
doujinmode.net, exhentai.org, hbrowse.com, hentai2read.com,
|
||||
hentai-foundry.com, hitomi.la, luscious.net, nhentai.net
|
||||
hentaibox.net, hitomi.la, luscious.net, nhentai.net
|
||||
* Japanese:
|
||||
pixiv.net, nijie.info
|
||||
nijie.info, pixiv.net
|
||||
* Western:
|
||||
deviantart.com, imgth.com, imgur.com, tumblr.com
|
||||
deviantart.com, hentai-foundry.com, imgth.com, imgur.com, tumblr.com
|
||||
* Futaba Channel-like:
|
||||
4chan.org, 8ch.net
|
||||
* Image Hosts:
|
||||
chronos.to, imagebam.com, imagetwist.com, imgbox.com, imgchili.net, img.yt,
|
||||
chronos.to, imagebam.com, imagetwist.com, img.yt, imgbox.com, imgchili.net,
|
||||
turboimagehost.com
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ modules = [
|
||||
"gelbooru",
|
||||
"hbrowse",
|
||||
"hentai2read",
|
||||
"hentaibox",
|
||||
"hentaifoundry",
|
||||
"hitomi",
|
||||
"imagebam",
|
||||
|
54
gallery_dl/extractor/hentaibox.py
Normal file
54
gallery_dl/extractor/hentaibox.py
Normal file
@ -0,0 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2016 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.
|
||||
|
||||
"""Extract images from http://www.hentaibox.net/"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text, iso639_1
|
||||
|
||||
class HentaiboxChapterExtractor(Extractor):
|
||||
|
||||
category = "hentaibox"
|
||||
subcategory = "chapter"
|
||||
directory_fmt = ["{category}", "{series}", "{title}"]
|
||||
filename_fmt = "{num:>03}.{extension}"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?hentaibox\.net/[^/]+/(\d+)_\d+_([^/&]+)"]
|
||||
test = [("http://www.hentaibox.net/hentai-manga/16_18_Original_Amazon-No-Hiyaku-Amazon-Elixir-Decensored", {
|
||||
"url": "d1a50a9b289d284f178971e01cf312791888e057",
|
||||
"keyword": "294eda384689d4f1178ec952560d0dedd3e38647",
|
||||
})]
|
||||
|
||||
def __init__(self, match):
|
||||
Extractor.__init__(self)
|
||||
self.url = match.group(0)
|
||||
self.count = match.group(1)
|
||||
|
||||
def items(self):
|
||||
page = self.request(self.url + "&slideshow=play").text
|
||||
data = self.get_job_metadata(page)
|
||||
yield Message.Version, 1
|
||||
yield Message.Directory, data
|
||||
for num, url in enumerate(self.get_image_urls(page), 1):
|
||||
data["num"] = num
|
||||
data["extension"] = url[url.rfind(".")+1:]
|
||||
yield Message.Url, url, data
|
||||
|
||||
def get_job_metadata(self, page):
|
||||
"""Collect metadata for extractor-job"""
|
||||
data = text.extract_all(page, (
|
||||
("title" , 'content="Read or Download ', ' hentai manga from'),
|
||||
("series" , ' the series ', ' with ' + self.count),
|
||||
("language", ' translated pages to ', '.'),
|
||||
), values={"category": self.category, "count": self.count})[0]
|
||||
data["lang"] = iso639_1.language_to_code(data["language"])
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def get_image_urls(page):
|
||||
"""Extract and return a list of all image-urls"""
|
||||
yield from text.extract_iter(page, '<span class="slideshow_path">', '</span>')
|
Loading…
x
Reference in New Issue
Block a user