From 2d34d8ff8bbec102358ef89ef5732fcb7afa0d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 14 Jan 2022 18:41:01 +0100 Subject: [PATCH] [reddit] allow downloading from quarantined subreddits (#2180) --- gallery_dl/extractor/reddit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index 55c963da..f7809de9 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2021 Mike Fährmann +# Copyright 2017-2022 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -19,7 +19,7 @@ class RedditExtractor(Extractor): directory_fmt = ("{category}", "{subreddit}") filename_fmt = "{id}{num:? //>02} {title[:220]}.{extension}" archive_fmt = "{filename}" - cookiedomain = None + cookiedomain = ".reddit.com" def items(self): self.api = RedditAPI(self) @@ -301,6 +301,12 @@ class RedditAPI(): else: self.refresh_token = token + if not self.refresh_token: + # allow downloading from quarantined subreddits (#2180) + extractor._cookiejar.set( + "_options", '%7B%22pref_quarantine_optin%22%3A%20true%7D', + domain=extractor.cookiedomain) + def submission(self, submission_id): """Fetch the (submission, comments)=-tuple for a submission id""" endpoint = "/comments/" + submission_id + "/.json"