From 88193718e837d79254d1ec0ffa3096564e79bd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 9 Nov 2016 12:03:14 +0100 Subject: [PATCH] [pixhost] add extractor --- gallery_dl/extractor/imagehosts.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 1c5f736e..8ae13fac 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -20,6 +20,7 @@ class ImagehostImageExtractor(Extractor): https = False method = "post" params = "simple" + cookies = None def __init__(self, match): Extractor.__init__(self) @@ -42,7 +43,8 @@ class ImagehostImageExtractor(Extractor): self.method = "get" def items(self): - page = self.request(self.url, method=self.method, data=self.params).text + page = self.request(self.url, method=self.method, data=self.params, + cookies=self.cookies).text url, filename = self.get_info(page) data = text.nameext_from_url(filename, {"token": self.token}) if self.https and url.startswith("http:"): @@ -249,6 +251,21 @@ class ImgtrexImageExtractor(ImagehostImageExtractor): return url, filename +class PixhostImageExtractor(ImagehostImageExtractor): + """Extractor for single images from pixhost.org""" + category = "pixhost" + pattern = [(r"(?:https?://)?((?:www\.)?pixhost\.org/show/" + r"\d+/(\d+)_[^/]+)")] + params = None + cookies = {"pixhostads": "1", "pixhosttest": "1"} + + def get_info(self, page): + filename, pos = text.extract(page, '
\n

', '

') + url , pos = text.extract(page, '