mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 14:45:14 +00:00 
			
		
		
		
	[YoutubeDL] Use DataHandler
This commit is contained in:
		| @@ -37,6 +37,7 @@ from .compat import ( | |||||||
|     compat_tokenize_tokenize, |     compat_tokenize_tokenize, | ||||||
|     compat_urllib_error, |     compat_urllib_error, | ||||||
|     compat_urllib_request, |     compat_urllib_request, | ||||||
|  |     compat_urllib_request_DataHandler, | ||||||
| ) | ) | ||||||
| from .utils import ( | from .utils import ( | ||||||
|     ContentTooShortError, |     ContentTooShortError, | ||||||
| @@ -1967,8 +1968,9 @@ class YoutubeDL(object): | |||||||
|         debuglevel = 1 if self.params.get('debug_printtraffic') else 0 |         debuglevel = 1 if self.params.get('debug_printtraffic') else 0 | ||||||
|         https_handler = make_HTTPS_handler(self.params, debuglevel=debuglevel) |         https_handler = make_HTTPS_handler(self.params, debuglevel=debuglevel) | ||||||
|         ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel) |         ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel) | ||||||
|  |         data_handler = compat_urllib_request_DataHandler() | ||||||
|         opener = compat_urllib_request.build_opener( |         opener = compat_urllib_request.build_opener( | ||||||
|             proxy_handler, https_handler, cookie_processor, ydlh) |             proxy_handler, https_handler, cookie_processor, ydlh, data_handler) | ||||||
|  |  | ||||||
|         # Delete the default user-agent header, which would otherwise apply in |         # Delete the default user-agent header, which would otherwise apply in | ||||||
|         # cases where our custom HTTP handler doesn't come into play |         # cases where our custom HTTP handler doesn't come into play | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Yen Chi Hsuan
					Yen Chi Hsuan