Added ability to download GIFs instead of mp4 from Luscious and Reactor (#1701)
This commit is contained in:
parent
9429eaa0a3
commit
fa6af46756
@ -1324,6 +1324,19 @@ Description
|
|||||||
the first in the list gets chosen (usually `mp3`).
|
the first in the list gets chosen (usually `mp3`).
|
||||||
|
|
||||||
|
|
||||||
|
extractor.luscious.gif
|
||||||
|
--------------------------
|
||||||
|
Type
|
||||||
|
``bool``
|
||||||
|
Default
|
||||||
|
``false``
|
||||||
|
Description
|
||||||
|
Format in which to download animated images.
|
||||||
|
|
||||||
|
Use ``true`` to download animated images as gifs and ``false``
|
||||||
|
to download as mp4 videos.
|
||||||
|
|
||||||
|
|
||||||
extractor.mangadex.api-server
|
extractor.mangadex.api-server
|
||||||
-----------------------------
|
-----------------------------
|
||||||
Type
|
Type
|
||||||
@ -1627,6 +1640,19 @@ Description
|
|||||||
Also search Plurk comments for URLs.
|
Also search Plurk comments for URLs.
|
||||||
|
|
||||||
|
|
||||||
|
extractor.reactor.gif
|
||||||
|
--------------------------
|
||||||
|
Type
|
||||||
|
``bool``
|
||||||
|
Default
|
||||||
|
``false``
|
||||||
|
Description
|
||||||
|
Format in which to download animated images.
|
||||||
|
|
||||||
|
Use ``true`` to download animated images as gifs and ``false``
|
||||||
|
to download as mp4 videos.
|
||||||
|
|
||||||
|
|
||||||
extractor.readcomiconline.captcha
|
extractor.readcomiconline.captcha
|
||||||
---------------------------------
|
---------------------------------
|
||||||
Type
|
Type
|
||||||
|
@ -147,6 +147,10 @@
|
|||||||
{
|
{
|
||||||
"format": "mp3"
|
"format": "mp3"
|
||||||
},
|
},
|
||||||
|
"luscious":
|
||||||
|
{
|
||||||
|
"gif": false
|
||||||
|
},
|
||||||
"mangadex":
|
"mangadex":
|
||||||
{
|
{
|
||||||
"api-server": "https://api.mangadex.org",
|
"api-server": "https://api.mangadex.org",
|
||||||
@ -198,6 +202,7 @@
|
|||||||
},
|
},
|
||||||
"reactor":
|
"reactor":
|
||||||
{
|
{
|
||||||
|
"gif": false,
|
||||||
"sleep-request": 5.0
|
"sleep-request": 5.0
|
||||||
},
|
},
|
||||||
"reddit":
|
"reddit":
|
||||||
|
@ -116,6 +116,7 @@ class LusciousAlbumExtractor(LusciousExtractor):
|
|||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
LusciousExtractor.__init__(self, match)
|
LusciousExtractor.__init__(self, match)
|
||||||
self.album_id = match.group(1)
|
self.album_id = match.group(1)
|
||||||
|
self.gif = self.config("gif", False)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
album = self.metadata()
|
album = self.metadata()
|
||||||
@ -130,7 +131,8 @@ class LusciousAlbumExtractor(LusciousExtractor):
|
|||||||
image["date"] = text.parse_timestamp(image["created"])
|
image["date"] = text.parse_timestamp(image["created"])
|
||||||
image["id"] = text.parse_int(image["id"])
|
image["id"] = text.parse_int(image["id"])
|
||||||
|
|
||||||
url = image["url_to_video"] or image["url_to_original"]
|
url = image["url_to_original"] or image["url_to_video"] \
|
||||||
|
if self.gif else image["url_to_video"] or image["url_to_original"]
|
||||||
yield Message.Url, url, text.nameext_from_url(url, image)
|
yield Message.Url, url, text.nameext_from_url(url, image)
|
||||||
|
|
||||||
def metadata(self):
|
def metadata(self):
|
||||||
|
@ -28,6 +28,7 @@ class ReactorExtractor(Extractor):
|
|||||||
Extractor.__init__(self, match)
|
Extractor.__init__(self, match)
|
||||||
self.root = "http://" + match.group(1)
|
self.root = "http://" + match.group(1)
|
||||||
self.session.headers["Referer"] = self.root
|
self.session.headers["Referer"] = self.root
|
||||||
|
self.gif = self.config("gif", False)
|
||||||
|
|
||||||
if not self.category:
|
if not self.category:
|
||||||
# set category based on domain name
|
# 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:
|
elif "/post/webm/" not in url and "/post/mp4/" not in url:
|
||||||
url = url.replace("/post/", "/post/full/")
|
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 {
|
yield {
|
||||||
"url": url,
|
"url": url,
|
||||||
"post_id": post_id,
|
"post_id": post_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user