Compare commits

...

5 Commits

Author SHA1 Message Date
Yuen Sze Hong
8c488c71cc
Merge de10e0d2a7eaa6eb9c2d8bcf9a698266e292e908 into 3eb8d22ddb8982ca4fb56bb7a8d6517538bf14c6 2025-03-31 12:09:42 +08:00
dirkf
3eb8d22ddb
[JSInterp] Temporary fix for #33102 2025-03-31 04:21:09 +01:00
YuenSzeHong
de10e0d2a7
Merge branch 'ytdl-org:master' into master 2022-01-26 17:16:35 +08:00
YuenSzeHong
ab9555a5e3 checked flake8 2021-09-16 16:56:50 +08:00
YuenSzeHong
d24005da42 improve thumbnail resolution for tver 2021-09-16 16:43:47 +08:00
2 changed files with 18 additions and 0 deletions

View File

@ -571,12 +571,28 @@ class BrightcoveNewIE(AdobePassIE):
duration = float_or_none(json_data.get('duration'), 1000)
if duration is not None and duration <= 0:
is_live = True
common_res = ["160x90", "320x180", "480x270", "640x360", "768x432", "1024x576", "1280x720", "1366x768", "1920x1080"]
thumbnails = []
if '640x360' in json_data.get('poster'):
base_url = json_data.get('poster')
replace = '640x360'
else:
base_url = json_data.get('thumbnail')
replace = '160x90'
for res in common_res:
thumbnails.append({
'url': base_url.replace(replace, res),
'width': int(res.split('x')[0]),
'height': int(res.split('x')[1]),
'preference': len(thumbnails)
})
return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'description': clean_html(json_data.get('description')),
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
'thumbnails': thumbnails,
'duration': duration,
'timestamp': parse_iso8601(json_data.get('published_at')),
'uploader_id': json_data.get('account_id'),

View File

@ -686,6 +686,8 @@ class JSInterpreter(object):
raise self.Exception('Cannot get index {idx!r:.100}'.format(**locals()), expr=repr(obj), cause=e)
def _dump(self, obj, namespace):
if obj is JS_Undefined:
return 'undefined'
try:
return json.dumps(obj)
except TypeError: