Compare commits

..

No commits in common. "1e28f6bf743627b909135bb9a88537ad2deccaf0" and "487a90c8efe74644b14a1324374473960def41ae" have entirely different histories.

4 changed files with 23 additions and 57 deletions

View File

@ -12,7 +12,6 @@ from ..utils import (
get_element_html_by_id, get_element_html_by_id,
int_or_none, int_or_none,
lowercase_escape, lowercase_escape,
parse_qs,
try_get, try_get,
update_url_query, update_url_query,
) )
@ -112,18 +111,14 @@ class GoogleDriveIE(InfoExtractor):
self._caption_formats_ext.append(f.attrib['fmt_code']) self._caption_formats_ext.append(f.attrib['fmt_code'])
def _get_captions_by_type(self, video_id, subtitles_id, caption_type, def _get_captions_by_type(self, video_id, subtitles_id, caption_type,
origin_lang_code=None, origin_lang_name=None): origin_lang_code=None):
if not subtitles_id or not caption_type: if not subtitles_id or not caption_type:
return return
captions = {} captions = {}
for caption_entry in self._captions_xml.findall( for caption_entry in self._captions_xml.findall(
self._CAPTIONS_ENTRY_TAG[caption_type]): self._CAPTIONS_ENTRY_TAG[caption_type]):
caption_lang_code = caption_entry.attrib.get('lang_code') caption_lang_code = caption_entry.attrib.get('lang_code')
caption_name = caption_entry.attrib.get('name') or origin_lang_name if not caption_lang_code:
if not caption_lang_code or not caption_name:
self.report_warning(f'Missing necessary caption metadata. '
f'Need lang_code and name attributes. '
f'Found: {caption_entry.attrib}')
continue continue
caption_format_data = [] caption_format_data = []
for caption_format in self._caption_formats_ext: for caption_format in self._caption_formats_ext:
@ -134,7 +129,7 @@ class GoogleDriveIE(InfoExtractor):
'lang': (caption_lang_code if origin_lang_code is None 'lang': (caption_lang_code if origin_lang_code is None
else origin_lang_code), else origin_lang_code),
'type': 'track', 'type': 'track',
'name': caption_name, 'name': '',
'kind': '', 'kind': '',
} }
if origin_lang_code is not None: if origin_lang_code is not None:
@ -160,15 +155,14 @@ class GoogleDriveIE(InfoExtractor):
self._download_subtitles_xml(video_id, subtitles_id, hl) self._download_subtitles_xml(video_id, subtitles_id, hl)
if not self._captions_xml: if not self._captions_xml:
return return
track = next((t for t in self._captions_xml.findall('track') if t.attrib.get('cantran') == 'true'), None) track = self._captions_xml.find('track')
if track is None: if track is None:
return return
origin_lang_code = track.attrib.get('lang_code') origin_lang_code = track.attrib.get('lang_code')
origin_lang_name = track.attrib.get('name') if not origin_lang_code:
if not origin_lang_code or not origin_lang_name:
return return
return self._get_captions_by_type( return self._get_captions_by_type(
video_id, subtitles_id, 'automatic_captions', origin_lang_code, origin_lang_name) video_id, subtitles_id, 'automatic_captions', origin_lang_code)
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
@ -274,8 +268,10 @@ class GoogleDriveIE(InfoExtractor):
subtitles_id = None subtitles_id = None
ttsurl = get_value('ttsurl') ttsurl = get_value('ttsurl')
if ttsurl: if ttsurl:
# the subtitles ID is the vid param of the ttsurl query # the video Id for subtitles will be the last value in the ttsurl
subtitles_id = parse_qs(ttsurl).get('vid', [None])[-1] # query string
subtitles_id = ttsurl.encode().decode(
'unicode_escape').split('=')[-1]
self.cookiejar.clear(domain='.google.com', path='/', name='NID') self.cookiejar.clear(domain='.google.com', path='/', name='NID')

View File

@ -18,7 +18,6 @@ from ..utils import (
url_or_none, url_or_none,
urljoin, urljoin,
) )
from ..utils.traversal import traverse_obj
class ITVIE(InfoExtractor): class ITVIE(InfoExtractor):
@ -224,7 +223,6 @@ class ITVBTCCIE(InfoExtractor):
}, },
'playlist_count': 12, 'playlist_count': 12,
}, { }, {
# news page, can have absent `data` field
'url': 'https://www.itv.com/news/2021-10-27/i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike', 'url': 'https://www.itv.com/news/2021-10-27/i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike',
'info_dict': { 'info_dict': {
'id': 'i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike', 'id': 'i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike',
@ -245,7 +243,7 @@ class ITVBTCCIE(InfoExtractor):
entries = [] entries = []
for video in json_map: for video in json_map:
if not any(traverse_obj(video, ('data', attr)) == 'Brightcove' for attr in ('name', 'type')): if not any(video['data'].get(attr) == 'Brightcove' for attr in ('name', 'type')):
continue continue
video_id = video['data']['id'] video_id = video['data']['id']
account_id = video['data']['accountId'] account_id = video['data']['accountId']

View File

@ -95,47 +95,26 @@ class KickVODIE(KickBaseIE):
IE_NAME = 'kick:vod' IE_NAME = 'kick:vod'
_VALID_URL = r'https?://(?:www\.)?kick\.com/[\w-]+/videos/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})' _VALID_URL = r'https?://(?:www\.)?kick\.com/[\w-]+/videos/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})'
_TESTS = [{ _TESTS = [{
# Regular VOD 'url': 'https://kick.com/xqc/videos/8dd97a8d-e17f-48fb-8bc3-565f88dbc9ea',
'url': 'https://kick.com/xqc/videos/5c697a87-afce-4256-b01f-3c8fe71ef5cb', 'md5': '3870f94153e40e7121a6e46c068b70cb',
'info_dict': { 'info_dict': {
'id': '5c697a87-afce-4256-b01f-3c8fe71ef5cb', 'id': '8dd97a8d-e17f-48fb-8bc3-565f88dbc9ea',
'ext': 'mp4', 'ext': 'mp4',
'title': '🐗LIVE🐗CLICK🐗HERE🐗DRAMA🐗ALL DAY🐗NEWS🐗VIDEOS🐗CLIPS🐗GAMES🐗STUFF🐗WOW🐗IM HERE🐗LETS GO🐗COOL🐗VERY NICE🐗', 'title': '18+ #ad 🛑LIVE🛑CLICK🛑DRAMA🛑NEWS🛑STUFF🛑REACT🛑GET IN HHERE🛑BOP BOP🛑WEEEE WOOOO🛑',
'description': 'THE BEST AT ABSOLUTELY EVERYTHING. THE JUICER. LEADER OF THE JUICERS.', 'description': 'THE BEST AT ABSOLUTELY EVERYTHING. THE JUICER. LEADER OF THE JUICERS.',
'uploader': 'xQc',
'uploader_id': '676',
'channel': 'xqc', 'channel': 'xqc',
'channel_id': '668', 'channel_id': '668',
'view_count': int, 'uploader': 'xQc',
'age_limit': 18, 'uploader_id': '676',
'duration': 22278.0, 'upload_date': '20240909',
'timestamp': 1725919141,
'duration': 10155.0,
'thumbnail': r're:^https?://.*\.jpg', 'thumbnail': r're:^https?://.*\.jpg',
'categories': ['Deadlock'], 'view_count': int,
'timestamp': 1756082443, 'categories': ['Just Chatting'],
'upload_date': '20250825', 'age_limit': 0,
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
}, {
# VOD of ongoing livestream (at the time of writing the test, ID rotates every two days)
'url': 'https://kick.com/a-log-burner/videos/5230df84-ea38-46e1-be4f-f5949ae55641',
'info_dict': {
'id': '5230df84-ea38-46e1-be4f-f5949ae55641',
'ext': 'mp4',
'title': r're:😴 Cozy Fireplace ASMR 🔥 | Relax, Focus, Sleep 💤',
'description': 'md5:080bc713eac0321a7b376a1b53816d1b',
'uploader': 'A_Log_Burner',
'uploader_id': '65114691',
'channel': 'a-log-burner',
'channel_id': '63967687',
'view_count': int,
'age_limit': 18,
'thumbnail': r're:^https?://.*\.jpg',
'categories': ['Other, Watch Party'],
'timestamp': int,
'upload_date': str,
'live_status': 'is_live',
},
'skip': 'live',
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -158,7 +137,6 @@ class KickVODIE(KickBaseIE):
'categories': ('livestream', 'categories', ..., 'name', {str}), 'categories': ('livestream', 'categories', ..., 'name', {str}),
'view_count': ('views', {int_or_none}), 'view_count': ('views', {int_or_none}),
'age_limit': ('livestream', 'is_mature', {bool}, {lambda x: 18 if x else 0}), 'age_limit': ('livestream', 'is_mature', {bool}, {lambda x: 18 if x else 0}),
'is_live': ('livestream', 'is_live', {bool}),
}), }),
} }

View File

@ -45,8 +45,6 @@ class TVerIE(StreaksBaseIE):
'release_timestamp': 1651453200, 'release_timestamp': 1651453200,
'release_date': '20220502', 'release_date': '20220502',
'_old_archive_ids': ['brightcovenew ref:baeebeac-a2a6-4dbf-9eb3-c40d59b40068'], '_old_archive_ids': ['brightcovenew ref:baeebeac-a2a6-4dbf-9eb3-c40d59b40068'],
'series_id': 'sru35hwdd2',
'season_id': 'ss2lcn4af6',
}, },
}, { }, {
# via Brightcove backend (deprecated) # via Brightcove backend (deprecated)
@ -69,8 +67,6 @@ class TVerIE(StreaksBaseIE):
'upload_date': '20220501', 'upload_date': '20220501',
'release_timestamp': 1651453200, 'release_timestamp': 1651453200,
'release_date': '20220502', 'release_date': '20220502',
'series_id': 'sru35hwdd2',
'season_id': 'ss2lcn4af6',
}, },
'params': {'extractor_args': {'tver': {'backend': ['brightcove']}}}, 'params': {'extractor_args': {'tver': {'backend': ['brightcove']}}},
}, { }, {
@ -206,8 +202,6 @@ class TVerIE(StreaksBaseIE):
'description': ('description', {str}), 'description': ('description', {str}),
'release_timestamp': ('viewStatus', 'startAt', {int_or_none}), 'release_timestamp': ('viewStatus', 'startAt', {int_or_none}),
'episode_number': ('no', {int_or_none}), 'episode_number': ('no', {int_or_none}),
'series_id': ('seriesID', {str}),
'season_id': ('seasonID', {str}),
}), }),
} }