mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[Canvas] Add subtitles
This commit is contained in:
		 Robin Houtevelts
					Robin Houtevelts
				
			
				
					committed by
					
						 Sergey M․
						Sergey M․
					
				
			
			
				
	
			
			
			 Sergey M․
						Sergey M․
					
				
			
						parent
						
							8e0548e180
						
					
				
				
					commit
					8d3eeb36d7
				
			| @@ -53,6 +53,15 @@ class CanvasIE(InfoExtractor): | |||||||
|                     'url': format_url, |                     'url': format_url, | ||||||
|                 }) |                 }) | ||||||
|         self._sort_formats(formats) |         self._sort_formats(formats) | ||||||
|  |          | ||||||
|  |         subtitles = {} | ||||||
|  |         for target in data['subtitleUrls']: | ||||||
|  |             format_url, format_type = target.get('url'), target.get('type') | ||||||
|  |             if format_type == 'CLOSED': | ||||||
|  |                 subtitles['nl'] = [{ | ||||||
|  |                     'ext': 'vtt', | ||||||
|  |                     'url': format_url, | ||||||
|  |                 }] | ||||||
|  |  | ||||||
|         return { |         return { | ||||||
|             'id': video_id, |             'id': video_id, | ||||||
| @@ -62,4 +71,5 @@ class CanvasIE(InfoExtractor): | |||||||
|             'formats': formats, |             'formats': formats, | ||||||
|             'duration': float_or_none(data.get('duration'), 1000), |             'duration': float_or_none(data.get('duration'), 1000), | ||||||
|             'thumbnail': data.get('posterImageUrl'), |             'thumbnail': data.get('posterImageUrl'), | ||||||
|  |             'subtitles': subtitles, | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user