Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to download GIFs from Luscious and Reactor #1701

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,19 @@ Description
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
-----------------------------
Type
Expand Down Expand Up @@ -1558,6 +1571,19 @@ Description
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
---------------------------------
Type
Expand Down
5 changes: 5 additions & 0 deletions docs/gallery-dl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
{
"format": "mp3"
},
"luscious":
{
"gif": false
},
"mangadex":
{
"api-server": "https://api.mangadex.org",
Expand Down Expand Up @@ -196,6 +200,7 @@
},
"reactor":
{
"gif": false,
"sleep-request": 5.0
},
"reddit":
Expand Down
4 changes: 3 additions & 1 deletion gallery_dl/extractor/luscious.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class LusciousAlbumExtractor(LusciousExtractor):
def __init__(self, match):
LusciousExtractor.__init__(self, match)
self.album_id = match.group(1)
self.gif = self.config("gif", False)

def items(self):
album = self.metadata()
Expand All @@ -130,7 +131,8 @@ def items(self):
image["date"] = text.parse_timestamp(image["created"])
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)

def metadata(self):
Expand Down
7 changes: 7 additions & 0 deletions gallery_dl/extractor/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, match):
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
Expand Down Expand Up @@ -124,6 +125,12 @@ def _parse_post(self, post):
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,
Expand Down