mirror of
				https://github.com/ytdl-org/youtube-dl
				synced 2025-10-31 01:33:15 +00:00 
			
		
		
		
	[YouTube] Fix playlist continuation extraction
* thx coletdjnz, bashonly: yt-dlp/yt-dlp#12777
This commit is contained in:
		
							parent
							
								
									32b8d31780
								
							
						
					
					
						commit
						1b08d3281d
					
				| @ -3453,23 +3453,15 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): | |||||||
|         next_continuation = cls._extract_next_continuation_data(renderer) |         next_continuation = cls._extract_next_continuation_data(renderer) | ||||||
|         if next_continuation: |         if next_continuation: | ||||||
|             return next_continuation |             return next_continuation | ||||||
|         contents = [] |         for command in traverse_obj(renderer, ( | ||||||
|         for key in ('contents', 'items'): |                 ('contents', 'items', 'rows'), Ellipsis, 'continuationItemRenderer', | ||||||
|             contents.extend(try_get(renderer, lambda x: x[key], list) or []) |                 ('continuationEndpoint', ('button', 'buttonRenderer', 'command')), | ||||||
|         for content in contents: |                 (('commandExecutorCommand', 'commands', Ellipsis), None), T(dict))): | ||||||
|             if not isinstance(content, dict): |             continuation = traverse_obj(command, ('continuationCommand', 'token', T(compat_str))) | ||||||
|                 continue |  | ||||||
|             continuation_ep = try_get( |  | ||||||
|                 content, lambda x: x['continuationItemRenderer']['continuationEndpoint'], |  | ||||||
|                 dict) |  | ||||||
|             if not continuation_ep: |  | ||||||
|                 continue |  | ||||||
|             continuation = try_get( |  | ||||||
|                 continuation_ep, lambda x: x['continuationCommand']['token'], compat_str) |  | ||||||
|             if not continuation: |             if not continuation: | ||||||
|                 continue |                 continue | ||||||
|             ctp = continuation_ep.get('clickTrackingParams') |             ctp = command.get('clickTrackingParams') | ||||||
|             return YoutubeTabIE._build_continuation_query(continuation, ctp) |             return cls._build_continuation_query(continuation, ctp) | ||||||
| 
 | 
 | ||||||
|     def _entries(self, tab, item_id, webpage): |     def _entries(self, tab, item_id, webpage): | ||||||
|         tab_content = try_get(tab, lambda x: x['content'], dict) |         tab_content = try_get(tab, lambda x: x['content'], dict) | ||||||
| @ -3582,8 +3574,12 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): | |||||||
|                     # Downloading page may result in intermittent 5xx HTTP error |                     # Downloading page may result in intermittent 5xx HTTP error | ||||||
|                     # that is usually worked around with a retry |                     # that is usually worked around with a retry | ||||||
|                     response = self._download_json( |                     response = self._download_json( | ||||||
|                         'https://www.youtube.com/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', |                         'https://www.youtube.com/youtubei/v1/browse', | ||||||
|                         None, 'Downloading page %d%s' % (page_num, ' (retry #%d)' % count if count else ''), |                         None, 'Downloading page %d%s' % (page_num, ' (retry #%d)' % count if count else ''), | ||||||
|  |                         query={ | ||||||
|  |                             # 'key': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', | ||||||
|  |                             'prettyPrint': 'false', | ||||||
|  |                         }, | ||||||
|                         headers=headers, data=json.dumps(data).encode('utf8')) |                         headers=headers, data=json.dumps(data).encode('utf8')) | ||||||
|                     break |                     break | ||||||
|                 except ExtractorError as e: |                 except ExtractorError as e: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 dirkf
						dirkf