mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-30 22:25:19 +00:00 
			
		
		
		
	This commit is contained in:
		| @@ -1051,6 +1051,7 @@ from .telegraaf import TelegraafIE | |||||||
| from .telemb import TeleMBIE | from .telemb import TeleMBIE | ||||||
| from .telequebec import ( | from .telequebec import ( | ||||||
|     TeleQuebecIE, |     TeleQuebecIE, | ||||||
|  |     TeleQuebecEmissionIE, | ||||||
|     TeleQuebecLiveIE, |     TeleQuebecLiveIE, | ||||||
| ) | ) | ||||||
| from .teletask import TeleTaskIE | from .teletask import TeleTaskIE | ||||||
|   | |||||||
| @@ -10,19 +10,33 @@ from ..utils import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TeleQuebecIE(InfoExtractor): | class TeleQuebecBaseIE(InfoExtractor): | ||||||
|  |     @staticmethod | ||||||
|  |     def _limelight_result(media_id): | ||||||
|  |         return { | ||||||
|  |             '_type': 'url_transparent', | ||||||
|  |             'url': smuggle_url( | ||||||
|  |                 'limelight:media:' + media_id, {'geo_countries': ['CA']}), | ||||||
|  |             'ie_key': 'LimelightMedia', | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TeleQuebecIE(TeleQuebecBaseIE): | ||||||
|     _VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)' |     _VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)' | ||||||
|     _TESTS = [{ |     _TESTS = [{ | ||||||
|         'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york', |         # available till 01.01.2023 | ||||||
|         'md5': 'fe95a0957e5707b1b01f5013e725c90f', |         'url': 'http://zonevideo.telequebec.tv/media/37578/un-petit-choc-et-puis-repart/un-chef-a-la-cabane', | ||||||
|         'info_dict': { |         'info_dict': { | ||||||
|             'id': '20984', |             'id': '577116881b4b439084e6b1cf4ef8b1b3', | ||||||
|             'ext': 'mp4', |             'ext': 'mp4', | ||||||
|             'title': 'Le couronnement de New York', |             'title': 'Un petit choc et puis repart!', | ||||||
|             'description': 'md5:f5b3d27a689ec6c1486132b2d687d432', |             'description': 'md5:b04a7e6b3f74e32d7b294cffe8658374', | ||||||
|             'upload_date': '20170201', |             'upload_date': '20180222', | ||||||
|             'timestamp': 1485972222, |             'timestamp': 1519326631, | ||||||
|         } |         }, | ||||||
|  |         'params': { | ||||||
|  |             'skip_download': True, | ||||||
|  |         }, | ||||||
|     }, { |     }, { | ||||||
|         # no description |         # no description | ||||||
|         'url': 'http://zonevideo.telequebec.tv/media/30261', |         'url': 'http://zonevideo.telequebec.tv/media/30261', | ||||||
| @@ -31,22 +45,57 @@ class TeleQuebecIE(InfoExtractor): | |||||||
|  |  | ||||||
|     def _real_extract(self, url): |     def _real_extract(self, url): | ||||||
|         media_id = self._match_id(url) |         media_id = self._match_id(url) | ||||||
|  |  | ||||||
|         media_data = self._download_json( |         media_data = self._download_json( | ||||||
|             'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id, |             'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id, | ||||||
|             media_id)['media'] |             media_id)['media'] | ||||||
|         return { |  | ||||||
|             '_type': 'url_transparent', |         info = self._limelight_result(media_data['streamInfo']['sourceId']) | ||||||
|             'id': media_id, |         info.update({ | ||||||
|             'url': smuggle_url( |             'title': media_data.get('title'), | ||||||
|                 'limelight:media:' + media_data['streamInfo']['sourceId'], |  | ||||||
|                 {'geo_countries': ['CA']}), |  | ||||||
|             'title': media_data['title'], |  | ||||||
|             'description': try_get( |             'description': try_get( | ||||||
|                 media_data, lambda x: x['descriptions'][0]['text'], compat_str), |                 media_data, lambda x: x['descriptions'][0]['text'], compat_str), | ||||||
|             'duration': int_or_none( |             'duration': int_or_none( | ||||||
|                 media_data.get('durationInMilliseconds'), 1000), |                 media_data.get('durationInMilliseconds'), 1000), | ||||||
|             'ie_key': 'LimelightMedia', |         }) | ||||||
|         } |         return info | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TeleQuebecEmissionIE(TeleQuebecBaseIE): | ||||||
|  |     _VALID_URL = r'https?://[^/]+\.telequebec\.tv/emissions/(?P<id>[^?#&]+)' | ||||||
|  |     _TESTS = [{ | ||||||
|  |         'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente', | ||||||
|  |         'info_dict': { | ||||||
|  |             'id': '66648a6aef914fe3badda25e81a4d50a', | ||||||
|  |             'ext': 'mp4', | ||||||
|  |             'title': "Des soins esthétiques à 377 % d'intérêts annuels, ça vous tente?", | ||||||
|  |             'description': 'md5:369e0d55d0083f1fc9b71ffb640ea014', | ||||||
|  |             'upload_date': '20171024', | ||||||
|  |             'timestamp': 1508862118, | ||||||
|  |         }, | ||||||
|  |         'params': { | ||||||
|  |             'skip_download': True, | ||||||
|  |         }, | ||||||
|  |     }, { | ||||||
|  |         'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression', | ||||||
|  |         'only_matching': True, | ||||||
|  |     }] | ||||||
|  |  | ||||||
|  |     def _real_extract(self, url): | ||||||
|  |         display_id = self._match_id(url) | ||||||
|  |  | ||||||
|  |         webpage = self._download_webpage(url, display_id) | ||||||
|  |  | ||||||
|  |         media_id = self._search_regex( | ||||||
|  |             r'mediaUID\s*:\s*["\'][Ll]imelight_(?P<id>[a-z0-9]{32})', webpage, | ||||||
|  |             'limelight id') | ||||||
|  |  | ||||||
|  |         info = self._limelight_result(media_id) | ||||||
|  |         info.update({ | ||||||
|  |             'title': self._og_search_title(webpage, default=None), | ||||||
|  |             'description': self._og_search_description(webpage, default=None), | ||||||
|  |         }) | ||||||
|  |         return info | ||||||
|  |  | ||||||
|  |  | ||||||
| class TeleQuebecLiveIE(InfoExtractor): | class TeleQuebecLiveIE(InfoExtractor): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sergey M․
					Sergey M․