diff --git a/docs/configuration.rst b/docs/configuration.rst index 309f4dd2..52fbda97 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -983,6 +983,21 @@ Description The ``refresh-token`` value you get from =========== ===== +extractor.reddit.videos +----------------------- +=========== ===== +Type ``bool`` or ``string`` +Default ``true`` +Description Control video download behavior. + + * ``true``: Download videos and use `youtube-dl`_ to handle + HLS and DASH manifests + * ``"ytdl"``: Download videos and let `youtube-dl`_ handle all of + video extraction and download + * ``false``: Ignore videos +=========== ===== + + extractor.sankaku.wait-min & .wait-max -------------------------------------- =========== ===== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index efe15c73..a0daf857 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -122,6 +122,7 @@ "id-min": "0", "id-max": "zik0zj", "recursion": 0, + "videos": true, "user-agent": "Python:gallery-dl:0.8.4 (by /u/mikf1)" }, "sankaku": diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index a91409e8..a312c1c2 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -32,6 +32,8 @@ class RedditExtractor(Extractor): match_user = RedditUserExtractor.pattern.match parentdir = self.config("parent-directory") + videos = self.config("videos", True) + submissions = self.submissions() visited = set() depth = 0 @@ -52,11 +54,22 @@ class RedditExtractor(Extractor): if url.startswith("https://i.redd.it/"): text.nameext_from_url(url, submission) yield Message.Url, url, submission + elif submission["is_video"]: - text.nameext_from_url(url, submission) - yield Message.Url, "ytdl:" + url, submission + if videos: + text.nameext_from_url(url, submission) + if videos == "ytdl": + url = "https://www.reddit.com" + \ + submission["permalink"] + else: + submission["_ytdl_extra"] = { + "title": submission["title"], + } + yield Message.Url, "ytdl:" + url, submission + elif not submission["is_self"]: urls.append((url, submission)) + elif parentdir: yield Message.Directory, comments[0]