[tennistv] Fix extractor (Closes #104)

This commit is contained in:
pukkandan 2021-02-24 02:25:04 +05:30
parent b1bb77d75f
commit c8d83a22ef

View File

@ -69,7 +69,7 @@ def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
internal_id = self._search_regex(r'video=([0-9]+)', webpage, 'internal video id') internal_id = self._search_regex(r'video=([\w-]+)', webpage, 'internal video id')
headers = { headers = {
'Origin': 'https://www.tennistv.com', 'Origin': 'https://www.tennistv.com',
@ -79,7 +79,7 @@ def _real_extract(self, url):
} }
check_data = { check_data = {
'videoID': internal_id, 'videoID': internal_id,
'VideoUrlType': 'HLSV3', 'VideoUrlType': 'HLS',
} }
check_json = json.dumps(check_data).encode('utf-8') check_json = json.dumps(check_data).encode('utf-8')
check_result = self._download_json( check_result = self._download_json(
@ -87,8 +87,9 @@ def _real_extract(self, url):
video_id, note='Checking video authorization', headers=headers, data=check_json) video_id, note='Checking video authorization', headers=headers, data=check_json)
formats = self._extract_m3u8_formats(check_result['contentUrl'], video_id, ext='mp4') formats = self._extract_m3u8_formats(check_result['contentUrl'], video_id, ext='mp4')
vdata_url = 'https://www.tennistv.com/api/channels/v1/de/none/video/%s' % video_id vdata = self._download_json(
vdata = self._download_json(vdata_url, video_id) 'https://www.tennistv.com/api/en/v2/none/common/video/%s' % video_id,
video_id, headers=headers)
timestamp = unified_timestamp(vdata['timestamp']) timestamp = unified_timestamp(vdata['timestamp'])
thumbnail = vdata['video']['thumbnailUrl'] thumbnail = vdata['video']['thumbnailUrl']