diff options
author | OMEGA_RAZER <869111+OMEGARAZER@users.noreply.github.com> | 2023-02-06 08:51:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 19:21:39 +0530 |
commit | c77df98b1a477a020a57141464d10c0f4d0fdbc9 (patch) | |
tree | 7851fe6ece357524da0141e4b28d76adf04d575f | |
parent | d27bde98832e3b7ffb39f3cf6346011b97bb3bc3 (diff) | |
download | hypervideo-pre-c77df98b1a477a020a57141464d10c0f4d0fdbc9.tar.lz hypervideo-pre-c77df98b1a477a020a57141464d10c0f4d0fdbc9.tar.xz hypervideo-pre-c77df98b1a477a020a57141464d10c0f4d0fdbc9.zip |
[extractor/reddit] Support user posts (#6173)
Authored by: OMEGARAZER
-rw-r--r-- | yt_dlp/extractor/reddit.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/yt_dlp/extractor/reddit.py b/yt_dlp/extractor/reddit.py index 836b3a7ae..9dba3eca8 100644 --- a/yt_dlp/extractor/reddit.py +++ b/yt_dlp/extractor/reddit.py @@ -14,7 +14,7 @@ from ..utils import ( class RedditIE(InfoExtractor): - _VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/r/(?P<slug>[^/]+/comments/(?P<id>[^/?#&]+))' + _VALID_URL = r'https?://(?P<subdomain>[^/]+\.)?reddit(?:media)?\.com/(?P<slug>(?:r|user)/[^/]+/comments/(?P<id>[^/?#&]+))' _TESTS = [{ 'url': 'https://www.reddit.com/r/videos/comments/6rrwyj/that_small_heart_attack/', 'info_dict': { @@ -59,6 +59,29 @@ class RedditIE(InfoExtractor): 'channel_id': 'aww', }, }, { + # User post + 'url': 'https://www.reddit.com/user/creepyt0es/comments/nip71r/i_plan_to_make_more_stickers_and_prints_check/', + 'info_dict': { + 'id': 'zasobba6wp071', + 'ext': 'mp4', + 'display_id': 'nip71r', + 'title': 'I plan to make more stickers and prints! Check them out on my Etsy! Or get them through my Patreon. Links below.', + 'thumbnail': r're:^https?://.*\.(?:jpg|png)', + 'thumbnails': 'count:5', + 'timestamp': 1621709093, + 'upload_date': '20210522', + 'uploader': 'creepyt0es', + 'duration': 6, + 'like_count': int, + 'dislike_count': int, + 'comment_count': int, + 'age_limit': 0, + 'channel_id': 'u_creepyt0es', + }, + 'params': { + 'skip_download': True, + }, + }, { # videos embedded in reddit text post 'url': 'https://www.reddit.com/r/KamenRider/comments/wzqkxp/finale_kamen_rider_revice_episode_50_family_to/', 'playlist_count': 2, @@ -84,6 +107,7 @@ class RedditIE(InfoExtractor): 'dislike_count': int, 'comment_count': int, 'age_limit': 0, + 'channel_id': 'dumbfuckers_club', }, }, { 'url': 'https://www.reddit.com/r/videos/comments/6rrwyj', @@ -124,10 +148,10 @@ class RedditIE(InfoExtractor): self._set_cookie('.reddit.com', 'reddit_session', self._gen_session_id()) self._set_cookie('.reddit.com', '_options', '%7B%22pref_quarantine_optin%22%3A%20true%7D') - data = self._download_json(f'https://{subdomain}reddit.com/r/{slug}/.json', video_id, fatal=False) + data = self._download_json(f'https://{subdomain}reddit.com/{slug}/.json', video_id, fatal=False) if not data: # Fall back to old.reddit.com in case the requested subdomain fails - data = self._download_json(f'https://old.reddit.com/r/{slug}/.json', video_id) + data = self._download_json(f'https://old.reddit.com/{slug}/.json', video_id) data = data[0]['data']['children'][0]['data'] video_url = data['url'] |