diff options
Diffstat (limited to 'gallery_dl/extractor/reddit.py')
| -rw-r--r-- | gallery_dl/extractor/reddit.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index 8577e74..89eafc8 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -340,18 +340,16 @@ class RedditRedirectExtractor(Extractor): category = "reddit" subcategory = "redirect" pattern = (r"(?:https?://)?(?:" - r"(?:\w+\.)?reddit\.com/(?:(?:r)/([^/?#]+)))" + r"(?:\w+\.)?reddit\.com/(?:(r|u|user)/([^/?#]+)))" r"/s/([a-zA-Z0-9]{10})") example = "https://www.reddit.com/r/SUBREDDIT/s/abc456GHIJ" - def __init__(self, match): - Extractor.__init__(self, match) - self.subreddit = match.group(1) - self.share_url = match.group(2) - def items(self): - url = "https://www.reddit.com/r/" + self.subreddit + "/s/" + \ - self.share_url + sub_type, subreddit, share_url = self.groups + if sub_type == "u": + sub_type = "user" + url = "https://www.reddit.com/{}/{}/s/{}".format( + sub_type, subreddit, share_url) data = {"_extractor": RedditSubmissionExtractor} response = self.request(url, method="HEAD", allow_redirects=False, notfound="submission") |
