Added ability to download GIFs instead of mp4 from Luscious and Reactor (#1701)

This commit is contained in:
Nyasume
2021-08-12 16:12:42 +03:00
committed by GitHub
parent 9429eaa0a3
commit fa6af46756
4 changed files with 41 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ class ReactorExtractor(Extractor):
Extractor.__init__(self, match)
self.root = "http://" + match.group(1)
self.session.headers["Referer"] = self.root
self.gif = self.config("gif", False)
if not self.category:
# set category based on domain name
@@ -124,6 +125,12 @@ class ReactorExtractor(Extractor):
elif "/post/webm/" not in url and "/post/mp4/" not in url:
url = url.replace("/post/", "/post/full/")
if self.gif and ("/post/webm/" in url or "/post/mp4/" in url):
gif_url = text.extract(image, '<a href="', '"')[0]
if not gif_url:
continue
url = gif_url
yield {
"url": url,
"post_id": post_id,