From e2fb2c009cba39fa5329155945f6a0fcb011bb88 Mon Sep 17 00:00:00 2001 From: enduser420 <91022934+enduser420@users.noreply.github.com> Date: Sat, 18 Oct 2025 22:11:23 +0530 Subject: [PATCH] [reddit] support comment share link (#8434) --- gallery_dl/extractor/reddit.py | 4 ++-- test/results/reddit.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index e20d80e4..f14a9bf7 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -317,8 +317,8 @@ class RedditSubmissionExtractor(RedditExtractor): """Extractor for URLs from a submission on reddit.com""" subcategory = "submission" pattern = (r"(?:https?://)?(?:" - r"(?:\w+\.)?reddit\.com/(?:(?:r|u|user)/[^/?#]+" - r"/comments|gallery)|redd\.it)/([a-z0-9]+)") + r"(?:\w+\.)?reddit\.com/(?:(?:(?:r|u|user)/[^/?#]+/)?" + r"comments|gallery)|redd\.it)/([a-z0-9]+)") example = "https://www.reddit.com/r/SUBREDDIT/comments/id/" def __init__(self, match): diff --git a/test/results/reddit.py b/test/results/reddit.py index 43d24373..ca09e773 100644 --- a/test/results/reddit.py +++ b/test/results/reddit.py @@ -179,6 +179,15 @@ __tests__ = ( "#count" : 0, }, +{ + "#url" : "https://www.reddit.com/comments/1nz2ic5", + "#comment" : "comment share URL", + "#category": ("", "reddit", "submission"), + "#class" : reddit.RedditSubmissionExtractor, + "#pattern" : r"https://i\.redd\.it/\w+\.png", + "#count" : 2, +}, + { "#url" : "https://www.reddit.com/r/RobloxArt/comments/15ko0qu/", "#comment" : "comment embeds (#5366)",