]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Fix hashtag continuation
authorpukkandan <redacted>
Thu, 18 Feb 2021 08:24:06 +0000 (13:54 +0530)
committerpukkandan <redacted>
Thu, 18 Feb 2021 08:24:06 +0000 (13:54 +0530)
Eg: https://www.youtube.com/hashtag/youtube

:ci skip dl

youtube_dlc/extractor/youtube.py

index e8477db480c886ba3f0e4b19e14cb9b8d60a8e90..4a2f5f06b5574b020b2febd0c3d31cd69411e935 100644 (file)
@@ -58,7 +58,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
     _TFA_URL = 'https://accounts.google.com/_/signin/challenge?hl=en&TL={0}'
 
     _RESERVED_NAMES = (
-        r'embed|e|watch_popup|channel|c|user|playlist|watch|w|v|movies|results|shared|'
+        r'embed|e|watch_popup|channel|c|user|playlist|watch|w|v|movies|results|shared|hashtag|'
         r'storefront|oops|index|account|reporthistory|t/terms|about|upload|signin|logout|'
         r'feed/(?:watch_later|history|subscriptions|library|trending|recommended)')
 
@@ -2141,7 +2141,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
                         (?:
                             (?:channel|c|user)/|
                             (?P<not_channel>
-                                feed/|
+                                feed/|hashtag/|
                                 (?:playlist|watch)\?.*?\blist=
                             )|
                             (?!(?:%s)\b)  # Direct URLs
@@ -2775,6 +2775,7 @@ def extract_entries(parent_renderer):  # this needs to called again for continua
                 'gridVideoRenderer': (self._grid_entries, 'items'),
                 'playlistVideoRenderer': (self._playlist_entries, 'contents'),
                 'itemSectionRenderer': (self._playlist_entries, 'contents'),
+                'richItemRenderer': (extract_entries, 'contents'),  # for hashtag
             }
             continuation_items = try_get(
                 response, lambda x: x['onResponseReceivedActions'][0]['appendContinuationItemsAction']['continuationItems'], list)
@@ -2784,9 +2785,10 @@ def extract_entries(parent_renderer):  # this needs to called again for continua
                 if key not in known_renderers:
                     continue
                 video_items_renderer = {known_renderers[key][1]: continuation_items}
+                continuation_list = [None]
                 for entry in known_renderers[key][0](video_items_renderer):
                     yield entry
-                continuation = self._extract_continuation(video_items_renderer)
+                continuation = continuation_list[0] or self._extract_continuation(video_items_renderer)
                 break
             if video_items_renderer:
                 continue