mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	[infoq] Add audio only format if available (#11565)
* [infoq] Add audio only format if available Refactor cookie code into a function. Renamed formats to http_video, http_audio, rtmp_video Renamed extract functions to video instead of videos as they return one or no video. * [infoq] Rename to _extract_cookies as it more than one * [infoq] Remove redundant determine_ext * [infoq] Add comment about hardcoded URL * [infoq] Use _hidden_inputs instead of messy regex * [infoq] Probe if audio URL is valid Make it possible to pass headers to _is_valid_url * [infoq] Add audio only test
This commit is contained in:
		 Mattias Wadman
					Mattias Wadman
				
			
				
					committed by
					
						 Yen Chi Hsuan
						Yen Chi Hsuan
					
				
			
			
				
	
			
			
			 Yen Chi Hsuan
						Yen Chi Hsuan
					
				
			
						parent
						
							33da98f493
						
					
				
				
					commit
					45024183ae
				
			| @@ -1025,13 +1025,13 @@ class InfoExtractor(object): | ||||
|                 unique_formats.append(f) | ||||
|         formats[:] = unique_formats | ||||
|  | ||||
|     def _is_valid_url(self, url, video_id, item='video'): | ||||
|     def _is_valid_url(self, url, video_id, item='video', headers={}): | ||||
|         url = self._proto_relative_url(url, scheme='http:') | ||||
|         # For now assume non HTTP(S) URLs always valid | ||||
|         if not (url.startswith('http://') or url.startswith('https://')): | ||||
|             return True | ||||
|         try: | ||||
|             self._request_webpage(url, video_id, 'Checking %s URL' % item) | ||||
|             self._request_webpage(url, video_id, 'Checking %s URL' % item, headers=headers) | ||||
|             return True | ||||
|         except ExtractorError as e: | ||||
|             if isinstance(e.cause, compat_urllib_error.URLError): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user