Compare commits

...

4 Commits

Author SHA1 Message Date
pukkandan e6ab678e36
[extractor/hidive] Fix login
Fixes https://github.com/yt-dlp/yt-dlp/issues/6493#issuecomment-1462906556
2023-03-10 17:27:43 +05:30
pukkandan ab1de9cb1e
Support loading info.json with a list at it's root 2023-03-10 14:15:13 +05:30
makeworld 871c907454
[extractor/cbc:gem] Update `_VALID_URL` (#6499)
Authored by: makeworld-the-better-one
Closes #6395
2023-03-10 13:23:19 +05:30
Elyse 0551511b45
[extractor/twitch] Fix `is_live` (#6500)
Closes #6494
Authored by: elyse0
2023-03-10 12:42:38 +05:30
5 changed files with 23 additions and 16 deletions

View File

@ -3376,18 +3376,19 @@ class YoutubeDL:
[info_filename], mode='r',
openhook=fileinput.hook_encoded('utf-8'))) as f:
# FileInput doesn't have a read method, we can't call json.load
info = self.sanitize_info(json.loads('\n'.join(f)), self.params.get('clean_infojson', True))
try:
self.__download_wrapper(self.process_ie_result)(info, download=True)
except (DownloadError, EntryNotInPlaylist, ReExtractInfo) as e:
if not isinstance(e, EntryNotInPlaylist):
self.to_stderr('\r')
webpage_url = info.get('webpage_url')
if webpage_url is not None:
infos = [self.sanitize_info(info, self.params.get('clean_infojson', True))
for info in variadic(json.loads('\n'.join(f)))]
for info in infos:
try:
self.__download_wrapper(self.process_ie_result)(info, download=True)
except (DownloadError, EntryNotInPlaylist, ReExtractInfo) as e:
if not isinstance(e, EntryNotInPlaylist):
self.to_stderr('\r')
webpage_url = info.get('webpage_url')
if webpage_url is None:
raise
self.report_warning(f'The info failed to download: {e}; trying with URL {webpage_url}')
return self.download([webpage_url])
else:
raise
self.download([webpage_url])
return self._download_retcode
@staticmethod

View File

@ -952,6 +952,8 @@ def _real_main(argv=None):
parser.destroy()
try:
if opts.load_info_filename is not None:
if all_urls:
ydl.report_warning('URLs are ignored due to --load-info-json')
return ydl.download_with_info_file(expand_path(opts.load_info_filename))
else:
return ydl.download(all_urls)

View File

@ -202,7 +202,7 @@ class CBCPlayerIE(InfoExtractor):
class CBCGemIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>[0-9a-z-]+/s[0-9]+[a-z][0-9]+)'
_VALID_URL = r'https?://gem\.cbc\.ca/(?:media/)?(?P<id>[0-9a-z-]+/s[0-9]+[a-z][0-9]+)'
_TESTS = [{
# This is a normal, public, TV show video
'url': 'https://gem.cbc.ca/media/schitts-creek/s06e01',
@ -245,6 +245,9 @@ class CBCGemIE(InfoExtractor):
},
'params': {'format': 'bv'},
'skip': 'Geo-restricted to Canada',
}, {
'url': 'https://gem.cbc.ca/nadiyas-family-favourites/s01e01',
'only_matching': True,
}]
_GEO_COUNTRIES = ['CA']

View File

@ -47,15 +47,16 @@ class HiDiveIE(InfoExtractor):
login_webpage = self._download_webpage(
self._LOGIN_URL, None, 'Logging in', data=urlencode_postdata(data))
# If the user has multiple profiles on their account, select one. For now pick the first profile.
profile_id = self._search_regex(r'<button [^>]+?data-profile-id="(\w+)"', login_webpage, 'profile_id')
profile_id = self._search_regex(
r'<button [^>]+?data-profile-id="(\w+)"', login_webpage, 'profile id', default=None)
if profile_id is None:
return # If only one profile, Hidive auto-selects it
profile_id_hash = self._search_regex(r'\<button [^>]+?data-hash="(\w+)"', login_webpage, 'profile_id_hash')
self._request_webpage(
'https://www.hidive.com/ajax/chooseprofile', None,
data=urlencode_postdata({
'profileId': profile_id,
'hash': profile_id_hash,
'hash': self._search_regex(
r'\<button [^>]+?data-hash="(\w+)"', login_webpage, 'profile id hash'),
'returnUrl': '/dashboard'
}))

View File

@ -456,7 +456,7 @@ class TwitchVodIE(TwitchBaseIE):
thumbnail = url_or_none(info.get('previewThumbnailURL'))
is_live = None
if thumbnail:
if thumbnail.endswith('/404_processing_{width}x{height}.png'):
if re.findall(r'/404_processing_[^.?#]+\.png', thumbnail):
is_live, thumbnail = True, None
else:
is_live = False