mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 14:45:14 +00:00 
			
		
		
		
	switch more to unicode_literals
This commit is contained in:
		| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| import datetime | import datetime | ||||||
| import json | import json | ||||||
| import re | import re | ||||||
| @@ -10,19 +12,19 @@ from ..utils import ( | |||||||
|  |  | ||||||
| class BlinkxIE(InfoExtractor): | class BlinkxIE(InfoExtractor): | ||||||
|     _VALID_URL = r'^(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)' |     _VALID_URL = r'^(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)' | ||||||
|     _IE_NAME = u'blinkx' |     _IE_NAME = 'blinkx' | ||||||
|  |  | ||||||
|     _TEST = { |     _TEST = { | ||||||
|         u'url': u'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB', |         'url': 'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB', | ||||||
|         u'file': u'8aQUy7GV.mp4', |         'file': '8aQUy7GV.mp4', | ||||||
|         u'md5': u'2e9a07364af40163a908edbf10bb2492', |         'md5': '2e9a07364af40163a908edbf10bb2492', | ||||||
|         u'info_dict': { |         'info_dict': { | ||||||
|             u"title": u"Police Car Rolls Away", |             "title": "Police Car Rolls Away", | ||||||
|             u"uploader": u"stupidvideos.com", |             "uploader": "stupidvideos.com", | ||||||
|             u"upload_date": u"20131215", |             "upload_date": "20131215", | ||||||
|             u"description": u"A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!", |             "description": "A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!", | ||||||
|             u"duration": 14.886, |             "duration": 14.886, | ||||||
|             u"thumbnails": [{ |             "thumbnails": [{ | ||||||
|                 "width": 100, |                 "width": 100, | ||||||
|                 "height": 76, |                 "height": 76, | ||||||
|                 "url": "http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg", |                 "url": "http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg", | ||||||
| @@ -30,17 +32,17 @@ class BlinkxIE(InfoExtractor): | |||||||
|         }, |         }, | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     def _real_extract(self, url): |     def _real_extract(self, rl): | ||||||
|         m = re.match(self._VALID_URL, url) |         m = re.match(self._VALID_URL, rl) | ||||||
|         video_id = m.group('id') |         video_id = m.group('id') | ||||||
|         display_id = video_id[:8] |         display_id = video_id[:8] | ||||||
|  |  | ||||||
|         api_url = (u'https://apib4.blinkx.com/api.php?action=play_video&' + |         api_url = (u'https://apib4.blinkx.com/api.php?action=play_video&' + | ||||||
|                    u'video=%s' % video_id) |                    'video=%s' % video_id) | ||||||
|         data_json = self._download_webpage(api_url, display_id) |         data_json = self._download_webpage(api_url, display_id) | ||||||
|         data = json.loads(data_json)['api']['results'][0] |         data = json.loads(data_json)['api']['results'][0] | ||||||
|         dt = datetime.datetime.fromtimestamp(data['pubdate_epoch']) |         dt = datetime.datetime.fromtimestamp(data['pubdate_epoch']) | ||||||
|         upload_date = dt.strftime('%Y%m%d') |         pload_date = dt.strftime('%Y%m%d') | ||||||
|  |  | ||||||
|         duration = None |         duration = None | ||||||
|         thumbnails = [] |         thumbnails = [] | ||||||
| @@ -86,7 +88,7 @@ class BlinkxIE(InfoExtractor): | |||||||
|             'title': data['title'], |             'title': data['title'], | ||||||
|             'formats': formats, |             'formats': formats, | ||||||
|             'uploader': data['channel_name'], |             'uploader': data['channel_name'], | ||||||
|             'upload_date': upload_date, |             'upload_date': pload_date, | ||||||
|             'description': data.get('description'), |             'description': data.get('description'), | ||||||
|             'thumbnails': thumbnails, |             'thumbnails': thumbnails, | ||||||
|             'duration': duration, |             'duration': duration, | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| import re | import re | ||||||
| import json | import json | ||||||
|  |  | ||||||
| @@ -10,10 +12,9 @@ class DefenseGouvFrIE(InfoExtractor): | |||||||
|         r'ligthboxvideo/base-de-medias/webtv/(.*)') |         r'ligthboxvideo/base-de-medias/webtv/(.*)') | ||||||
|  |  | ||||||
|     _TEST = { |     _TEST = { | ||||||
|         u'url': (u'http://www.defense.gouv.fr/layout/set/ligthboxvideo/' |         'url': 'http://www.defense.gouv.fr/layout/set/ligthboxvideo/base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1', | ||||||
|         u'base-de-medias/webtv/attaque-chimique-syrienne-du-21-aout-2013-1'), |         'file': '11213.mp4', | ||||||
|         u'file': u'11213.mp4', |         'md5': '75bba6124da7e63d2d60b5244ec9430c', | ||||||
|         u'md5': u'75bba6124da7e63d2d60b5244ec9430c', |  | ||||||
|         "info_dict": { |         "info_dict": { | ||||||
|             "title": "attaque-chimique-syrienne-du-21-aout-2013-1" |             "title": "attaque-chimique-syrienne-du-21-aout-2013-1" | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Hagemeister
					Philipp Hagemeister