mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	Py2/3 compatibility for http.client
This commit is contained in:
		| @@ -1,7 +1,6 @@ | |||||||
| #!/usr/bin/env python | #!/usr/bin/env python | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
|  |  | ||||||
| import httplib |  | ||||||
| import math | import math | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
| @@ -460,7 +459,7 @@ class FileDownloader(object): | |||||||
| 					success = self._do_download(filename, info_dict) | 					success = self._do_download(filename, info_dict) | ||||||
| 				except (OSError, IOError) as err: | 				except (OSError, IOError) as err: | ||||||
| 					raise UnavailableVideoError | 					raise UnavailableVideoError | ||||||
| 				except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 				except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 					self.trouble(u'ERROR: unable to download video data: %s' % str(err)) | 					self.trouble(u'ERROR: unable to download video data: %s' % str(err)) | ||||||
| 					return | 					return | ||||||
| 				except (ContentTooShortError, ) as err: | 				except (ContentTooShortError, ) as err: | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ | |||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
|  |  | ||||||
| import datetime | import datetime | ||||||
| import httplib |  | ||||||
| import netrc | import netrc | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
| @@ -253,7 +252,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_lang() | 			self.report_lang() | ||||||
| 			compat_urllib_request.urlopen(request).read() | 			compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.to_stderr(u'WARNING: unable to set language: %s' % compat_str(err)) | 			self._downloader.to_stderr(u'WARNING: unable to set language: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -276,7 +275,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 			if re.search(r'(?i)<form[^>]* name="loginForm"', login_results) is not None: | 			if re.search(r'(?i)<form[^>]* name="loginForm"', login_results) is not None: | ||||||
| 				self._downloader.to_stderr(u'WARNING: unable to log in: bad username or password') | 				self._downloader.to_stderr(u'WARNING: unable to log in: bad username or password') | ||||||
| 				return | 				return | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.to_stderr(u'WARNING: unable to log in: %s' % compat_str(err)) | 			self._downloader.to_stderr(u'WARNING: unable to log in: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -289,7 +288,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_age_confirmation() | 			self.report_age_confirmation() | ||||||
| 			age_results = compat_urllib_request.urlopen(request).read() | 			age_results = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to confirm age: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to confirm age: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -311,7 +310,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request('http://www.youtube.com/watch?v=%s&gl=US&hl=en&has_verified=1' % video_id) | 		request = compat_urllib_request.Request('http://www.youtube.com/watch?v=%s&gl=US&hl=en&has_verified=1' % video_id) | ||||||
| 		try: | 		try: | ||||||
| 			video_webpage = compat_urllib_request.urlopen(request).read() | 			video_webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -333,7 +332,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 				video_info = parse_qs(video_info_webpage) | 				video_info = parse_qs(video_info_webpage) | ||||||
| 				if 'token' in video_info: | 				if 'token' in video_info: | ||||||
| 					break | 					break | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
| 		if 'token' not in video_info: | 		if 'token' not in video_info: | ||||||
| @@ -396,7 +395,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 				request = compat_urllib_request.Request('http://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id) | 				request = compat_urllib_request.Request('http://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id) | ||||||
| 				try: | 				try: | ||||||
| 					srt_list = compat_urllib_request.urlopen(request).read() | 					srt_list = compat_urllib_request.urlopen(request).read() | ||||||
| 				except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 				except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 					raise Trouble(u'WARNING: unable to download video subtitles: %s' % compat_str(err)) | 					raise Trouble(u'WARNING: unable to download video subtitles: %s' % compat_str(err)) | ||||||
| 				srt_lang_list = re.findall(r'name="([^"]*)"[^>]+lang_code="([\w\-]+)"', srt_list) | 				srt_lang_list = re.findall(r'name="([^"]*)"[^>]+lang_code="([\w\-]+)"', srt_list) | ||||||
| 				srt_lang_list = dict((l[1], l[0]) for l in srt_lang_list) | 				srt_lang_list = dict((l[1], l[0]) for l in srt_lang_list) | ||||||
| @@ -413,7 +412,7 @@ class YoutubeIE(InfoExtractor): | |||||||
| 				request = compat_urllib_request.Request('http://www.youtube.com/api/timedtext?lang=%s&name=%s&v=%s' % (srt_lang, srt_lang_list[srt_lang], video_id)) | 				request = compat_urllib_request.Request('http://www.youtube.com/api/timedtext?lang=%s&name=%s&v=%s' % (srt_lang, srt_lang_list[srt_lang], video_id)) | ||||||
| 				try: | 				try: | ||||||
| 					srt_xml = compat_urllib_request.urlopen(request).read() | 					srt_xml = compat_urllib_request.urlopen(request).read() | ||||||
| 				except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 				except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 					raise Trouble(u'WARNING: unable to download video subtitles: %s' % compat_str(err)) | 					raise Trouble(u'WARNING: unable to download video subtitles: %s' % compat_str(err)) | ||||||
| 				if not srt_xml: | 				if not srt_xml: | ||||||
| 					raise Trouble(u'WARNING: unable to download video subtitles') | 					raise Trouble(u'WARNING: unable to download video subtitles') | ||||||
| @@ -535,7 +534,7 @@ class MetacafeIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_disclaimer() | 			self.report_disclaimer() | ||||||
| 			disclaimer = compat_urllib_request.urlopen(request).read() | 			disclaimer = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to retrieve disclaimer: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to retrieve disclaimer: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -548,7 +547,7 @@ class MetacafeIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_age_confirmation() | 			self.report_age_confirmation() | ||||||
| 			disclaimer = compat_urllib_request.urlopen(request).read() | 			disclaimer = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to confirm age: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to confirm age: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -572,7 +571,7 @@ class MetacafeIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -663,7 +662,7 @@ class DailymotionIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -759,7 +758,7 @@ class GoogleIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -798,7 +797,7 @@ class GoogleIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request('http://video.google.com/videosearch?q=%s+site:video.google.com&hl=en' % abs(int(video_id))) | 			request = compat_urllib_request.Request('http://video.google.com/videosearch?q=%s+site:video.google.com&hl=en' % abs(int(video_id))) | ||||||
| 			try: | 			try: | ||||||
| 				webpage = compat_urllib_request.urlopen(request).read() | 				webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
| 			mobj = re.search(r'<img class=thumbnail-img (?:.* )?src=(http.*)>', webpage) | 			mobj = re.search(r'<img class=thumbnail-img (?:.* )?src=(http.*)>', webpage) | ||||||
| @@ -852,7 +851,7 @@ class PhotobucketIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -920,7 +919,7 @@ class YahooIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(url) | 			request = compat_urllib_request.Request(url) | ||||||
| 			try: | 			try: | ||||||
| 				webpage = compat_urllib_request.urlopen(request).read() | 				webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -944,7 +943,7 @@ class YahooIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -1002,7 +1001,7 @@ class YahooIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -1058,7 +1057,7 @@ class VimeoIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -1164,7 +1163,7 @@ class ArteTvIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(url) | 			self.report_download_webpage(url) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
| 		except ValueError as err: | 		except ValueError as err: | ||||||
| @@ -1361,7 +1360,7 @@ class GenericIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
| 		except ValueError as err: | 		except ValueError as err: | ||||||
| @@ -1480,7 +1479,7 @@ class YoutubeSearchIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(result_url) | 			request = compat_urllib_request.Request(result_url) | ||||||
| 			try: | 			try: | ||||||
| 				data = compat_urllib_request.urlopen(request).read() | 				data = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download API page: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download API page: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
| 			api_response = json.loads(data)['data'] | 			api_response = json.loads(data)['data'] | ||||||
| @@ -1557,7 +1556,7 @@ class GoogleSearchIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(result_url) | 			request = compat_urllib_request.Request(result_url) | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read() | 				page = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1640,7 +1639,7 @@ class YahooSearchIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(result_url) | 			request = compat_urllib_request.Request(result_url) | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read() | 				page = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1710,7 +1709,7 @@ class YoutubePlaylistIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(url) | 			request = compat_urllib_request.Request(url) | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read() | 				page = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1767,7 +1766,7 @@ class YoutubeChannelIE(InfoExtractor): | |||||||
| 			request = compat_urllib_request.Request(url) | 			request = compat_urllib_request.Request(url) | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read() | 				page = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1830,7 +1829,7 @@ class YoutubeUserIE(InfoExtractor): | |||||||
|  |  | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read() | 				page = compat_urllib_request.urlopen(request).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1902,7 +1901,7 @@ class BlipTVUserIE(InfoExtractor): | |||||||
| 			page = compat_urllib_request.urlopen(request).read().decode('utf-8') | 			page = compat_urllib_request.urlopen(request).read().decode('utf-8') | ||||||
| 			mobj = re.search(r'data-users-id="([^"]+)"', page) | 			mobj = re.search(r'data-users-id="([^"]+)"', page) | ||||||
| 			page_base = page_base % mobj.group(1) | 			page_base = page_base % mobj.group(1) | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -1922,7 +1921,7 @@ class BlipTVUserIE(InfoExtractor): | |||||||
|  |  | ||||||
| 			try: | 			try: | ||||||
| 				page = compat_urllib_request.urlopen(request).read().decode('utf-8') | 				page = compat_urllib_request.urlopen(request).read().decode('utf-8') | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -1990,7 +1989,7 @@ class DepositFilesIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(file_id) | 			self.report_download_webpage(file_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve file webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve file webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2126,7 +2125,7 @@ class FacebookIE(InfoExtractor): | |||||||
| 			if re.search(r'<form(.*)name="login"(.*)</form>', login_results) is not None: | 			if re.search(r'<form(.*)name="login"(.*)</form>', login_results) is not None: | ||||||
| 				self._downloader.to_stderr(u'WARNING: unable to log in: bad username/password, or exceded login rate limit (~3/min). Check credentials or wait.') | 				self._downloader.to_stderr(u'WARNING: unable to log in: bad username/password, or exceded login rate limit (~3/min). Check credentials or wait.') | ||||||
| 				return | 				return | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.to_stderr(u'WARNING: unable to log in: %s' % compat_str(err)) | 			self._downloader.to_stderr(u'WARNING: unable to log in: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2143,7 +2142,7 @@ class FacebookIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			page = compat_urllib_request.urlopen(request) | 			page = compat_urllib_request.urlopen(request) | ||||||
| 			video_webpage = page.read() | 			video_webpage = page.read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2278,13 +2277,13 @@ class BlipTVIE(InfoExtractor): | |||||||
| 					'ext': ext, | 					'ext': ext, | ||||||
| 					'urlhandle': urlh | 					'urlhandle': urlh | ||||||
| 				} | 				} | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
| 		if info is None: # Regular URL | 		if info is None: # Regular URL | ||||||
| 			try: | 			try: | ||||||
| 				json_code = urlh.read() | 				json_code = urlh.read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to read video info webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to read video info webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -2352,7 +2351,7 @@ class MyVideoIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2449,7 +2448,7 @@ class ComedyCentralIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			htmlHandle = compat_urllib_request.urlopen(req) | 			htmlHandle = compat_urllib_request.urlopen(req) | ||||||
| 			html = htmlHandle.read() | 			html = htmlHandle.read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
| 		if dlNewest: | 		if dlNewest: | ||||||
| @@ -2482,7 +2481,7 @@ class ComedyCentralIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			urlHandle = compat_urllib_request.urlopen(playerUrl_raw) | 			urlHandle = compat_urllib_request.urlopen(playerUrl_raw) | ||||||
| 			playerUrl = urlHandle.geturl() | 			playerUrl = urlHandle.geturl() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to find out player URL: ' + compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to find out player URL: ' + compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2491,7 +2490,7 @@ class ComedyCentralIE(InfoExtractor): | |||||||
| 		self.report_index_download(epTitle) | 		self.report_index_download(epTitle) | ||||||
| 		try: | 		try: | ||||||
| 			indexXml = compat_urllib_request.urlopen(indexUrl).read() | 			indexXml = compat_urllib_request.urlopen(indexUrl).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download episode index: ' + compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download episode index: ' + compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2512,7 +2511,7 @@ class ComedyCentralIE(InfoExtractor): | |||||||
| 			self.report_config_download(epTitle) | 			self.report_config_download(epTitle) | ||||||
| 			try: | 			try: | ||||||
| 				configXml = compat_urllib_request.urlopen(configReq).read() | 				configXml = compat_urllib_request.urlopen(configReq).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -2595,7 +2594,7 @@ class EscapistIE(InfoExtractor): | |||||||
| 			webPageBytes = webPage.read() | 			webPageBytes = webPage.read() | ||||||
| 			m = re.match(r'text/html; charset="?([^"]+)"?', webPage.headers['Content-Type']) | 			m = re.match(r'text/html; charset="?([^"]+)"?', webPage.headers['Content-Type']) | ||||||
| 			webPage = webPageBytes.decode(m.group(1) if m else 'utf-8') | 			webPage = webPageBytes.decode(m.group(1) if m else 'utf-8') | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download webpage: ' + compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download webpage: ' + compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2611,7 +2610,7 @@ class EscapistIE(InfoExtractor): | |||||||
| 		self.report_config_download(showName) | 		self.report_config_download(showName) | ||||||
| 		try: | 		try: | ||||||
| 			configJSON = compat_urllib_request.urlopen(configUrl).read() | 			configJSON = compat_urllib_request.urlopen(configUrl).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download configuration: ' + compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download configuration: ' + compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2667,7 +2666,7 @@ class CollegeHumorIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(url) | 		request = compat_urllib_request.Request(url) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2688,7 +2687,7 @@ class CollegeHumorIE(InfoExtractor): | |||||||
| 		xmlUrl = 'http://www.collegehumor.com/moogaloop/video:' + internal_video_id | 		xmlUrl = 'http://www.collegehumor.com/moogaloop/video:' + internal_video_id | ||||||
| 		try: | 		try: | ||||||
| 			metaXml = compat_urllib_request.urlopen(xmlUrl).read() | 			metaXml = compat_urllib_request.urlopen(xmlUrl).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video info XML: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video info XML: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2733,7 +2732,7 @@ class XVideosIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(r'http://www.xvideos.com/video' + video_id) | 		request = compat_urllib_request.Request(r'http://www.xvideos.com/video' + video_id) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2817,7 +2816,7 @@ class SoundcloudIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request('http://soundcloud.com/%s/%s' % (uploader, slug_title)) | 		request = compat_urllib_request.Request('http://soundcloud.com/%s/%s' % (uploader, slug_title)) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2894,7 +2893,7 @@ class InfoQIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(url) | 		request = compat_urllib_request.Request(url) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -2973,7 +2972,7 @@ class MixcloudIE(InfoExtractor): | |||||||
| 			try: | 			try: | ||||||
| 				compat_urllib_request.urlopen(url) | 				compat_urllib_request.urlopen(url) | ||||||
| 				return url | 				return url | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				url = None | 				url = None | ||||||
|  |  | ||||||
| 		return None | 		return None | ||||||
| @@ -3006,7 +3005,7 @@ class MixcloudIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_json(file_url) | 			self.report_download_json(file_url) | ||||||
| 			jsonData = compat_urllib_request.urlopen(request).read() | 			jsonData = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve file: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve file: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3085,7 +3084,7 @@ class StanfordOpenClassroomIE(InfoExtractor): | |||||||
| 			xmlUrl = baseUrl + video + '.xml' | 			xmlUrl = baseUrl + video + '.xml' | ||||||
| 			try: | 			try: | ||||||
| 				metaXml = compat_urllib_request.urlopen(xmlUrl).read() | 				metaXml = compat_urllib_request.urlopen(xmlUrl).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download video info XML: %s' % compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download video info XML: %s' % compat_str(err)) | ||||||
| 				return | 				return | ||||||
| 			mdoc = xml.etree.ElementTree.fromstring(metaXml) | 			mdoc = xml.etree.ElementTree.fromstring(metaXml) | ||||||
| @@ -3109,7 +3108,7 @@ class StanfordOpenClassroomIE(InfoExtractor): | |||||||
| 			self.report_download_webpage(info['id']) | 			self.report_download_webpage(info['id']) | ||||||
| 			try: | 			try: | ||||||
| 				coursepage = compat_urllib_request.urlopen(url).read() | 				coursepage = compat_urllib_request.urlopen(url).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download course info page: ' + compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download course info page: ' + compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -3148,7 +3147,7 @@ class StanfordOpenClassroomIE(InfoExtractor): | |||||||
| 			rootURL = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php' | 			rootURL = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php' | ||||||
| 			try: | 			try: | ||||||
| 				rootpage = compat_urllib_request.urlopen(rootURL).read() | 				rootpage = compat_urllib_request.urlopen(rootURL).read() | ||||||
| 			except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 			except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 				self._downloader.trouble(u'ERROR: unable to download course info page: ' + compat_str(err)) | 				self._downloader.trouble(u'ERROR: unable to download course info page: ' + compat_str(err)) | ||||||
| 				return | 				return | ||||||
|  |  | ||||||
| @@ -3195,7 +3194,7 @@ class MTVIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(url) | 		request = compat_urllib_request.Request(url) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3228,7 +3227,7 @@ class MTVIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(videogen_url) | 		request = compat_urllib_request.Request(videogen_url) | ||||||
| 		try: | 		try: | ||||||
| 			metadataXml = compat_urllib_request.urlopen(request).read() | 			metadataXml = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video metadata: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: unable to download video metadata: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3316,7 +3315,7 @@ class YoukuIE(InfoExtractor): | |||||||
| 		try: | 		try: | ||||||
| 			self.report_download_webpage(video_id) | 			self.report_download_webpage(video_id) | ||||||
| 			jsondata = compat_urllib_request.urlopen(request).read() | 			jsondata = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3410,7 +3409,7 @@ class XNXXIE(InfoExtractor): | |||||||
| 		# Get webpage content | 		# Get webpage content | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(url).read() | 			webpage = compat_urllib_request.urlopen(url).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % err) | 			self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % err) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3490,7 +3489,7 @@ class GooglePlusIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(post_url) | 		request = compat_urllib_request.Request(post_url) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve entry webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve entry webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
|  |  | ||||||
| @@ -3532,7 +3531,7 @@ class GooglePlusIE(InfoExtractor): | |||||||
| 		request = compat_urllib_request.Request(video_page) | 		request = compat_urllib_request.Request(video_page) | ||||||
| 		try: | 		try: | ||||||
| 			webpage = compat_urllib_request.urlopen(request).read() | 			webpage = compat_urllib_request.urlopen(request).read() | ||||||
| 		except (compat_urllib_error.URLError, httplib.HTTPException, socket.error) as err: | 		except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: | ||||||
| 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | 			self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % compat_str(err)) | ||||||
| 			return | 			return | ||||||
| 		self.report_extract_vid_page(video_page) | 		self.report_extract_vid_page(video_page) | ||||||
|   | |||||||
| @@ -41,6 +41,12 @@ try: | |||||||
| except NameError: # Python 2 | except NameError: # Python 2 | ||||||
| 	import HTMLParser as compat_html_parser | 	import HTMLParser as compat_html_parser | ||||||
|  |  | ||||||
|  | try: | ||||||
|  | 	import http.client as compat_html_client | ||||||
|  | except NameError: # Python 2 | ||||||
|  | 	import httplib as compat_html_client | ||||||
|  |  | ||||||
|  |  | ||||||
| try: | try: | ||||||
| 	compat_str = unicode # Python 2 | 	compat_str = unicode # Python 2 | ||||||
| except NameError: | except NameError: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Hagemeister
					Philipp Hagemeister