mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-11 00:27:15 +08:00
Use default formats when it fails to find the video information.
This allows us to get the thumbnails.
This commit is contained in:
parent
58ef5e7881
commit
cfa689b1c9
@ -132,7 +132,6 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
video_params = self._download_json(
|
video_params = self._download_json(
|
||||||
'https://iview.abc.net.au/api/programs/' + video_id, video_id)
|
'https://iview.abc.net.au/api/programs/' + video_id, video_id)
|
||||||
title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])
|
title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])
|
||||||
stream = next(s for s in video_params['playlist'] if s.get('type') in ('program', 'livestream'))
|
|
||||||
|
|
||||||
house_number = video_params.get('episodeHouseNumber') or video_id
|
house_number = video_params.get('episodeHouseNumber') or video_id
|
||||||
path = '/auth/hls/sign?ts={0}&hn={1}&d=android-tablet'.format(
|
path = '/auth/hls/sign?ts={0}&hn={1}&d=android-tablet'.format(
|
||||||
@ -143,30 +142,111 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
token = self._download_webpage(
|
token = self._download_webpage(
|
||||||
'http://iview.abc.net.au{0}&sig={1}'.format(path, sig), video_id)
|
'http://iview.abc.net.au{0}&sig={1}'.format(path, sig), video_id)
|
||||||
|
|
||||||
def tokenize_url(url, token):
|
try:
|
||||||
return update_url_query(url, {
|
stream = next(s for s in video_params['playlist'] if s.get('type') in ('program', 'livestream'))
|
||||||
'hdnea': token,
|
|
||||||
})
|
|
||||||
|
|
||||||
for sd in ('sd', 'sd-low'):
|
def tokenize_url(url, token):
|
||||||
sd_url = try_get(
|
return update_url_query(url, {
|
||||||
stream, lambda x: x['streams']['hls'][sd], compat_str)
|
'hdnea': token,
|
||||||
if not sd_url:
|
})
|
||||||
continue
|
|
||||||
formats = self._extract_m3u8_formats(
|
|
||||||
tokenize_url(sd_url, token), video_id, 'mp4',
|
|
||||||
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
|
|
||||||
if formats:
|
|
||||||
break
|
|
||||||
self._sort_formats(formats)
|
|
||||||
|
|
||||||
subtitles = {}
|
for sd in ('sd', 'sd-low'):
|
||||||
src_vtt = stream.get('captions', {}).get('src-vtt')
|
sd_url = try_get(
|
||||||
if src_vtt:
|
stream, lambda x: x['streams']['hls'][sd], compat_str)
|
||||||
subtitles['en'] = [{
|
if not sd_url:
|
||||||
'url': src_vtt,
|
continue
|
||||||
'ext': 'vtt',
|
formats = self._extract_m3u8_formats(
|
||||||
}]
|
tokenize_url(sd_url, token), video_id, 'mp4',
|
||||||
|
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
|
||||||
|
if formats:
|
||||||
|
break
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
# import pprint
|
||||||
|
# pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
# pp.pprint(formats)
|
||||||
|
|
||||||
|
subtitles = {}
|
||||||
|
src_vtt = stream.get('captions', {}).get('src-vtt')
|
||||||
|
if src_vtt:
|
||||||
|
subtitles['en'] = [{
|
||||||
|
'url': src_vtt,
|
||||||
|
'ext': 'vtt',
|
||||||
|
}]
|
||||||
|
|
||||||
|
except:
|
||||||
|
subtitles = {}
|
||||||
|
formats = [{
|
||||||
|
u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-64',
|
||||||
|
u'fps': None,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 64.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_4_a.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'none'},
|
||||||
|
{ u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-234',
|
||||||
|
u'fps': None,
|
||||||
|
u'height': 180,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 234.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_4_av.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'avc1.77.30',
|
||||||
|
u'width': 320},
|
||||||
|
{ u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-508',
|
||||||
|
u'fps': None,
|
||||||
|
u'height': 288,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 508.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_3_av.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'avc1.77.30',
|
||||||
|
u'width': 512},
|
||||||
|
{ u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-630',
|
||||||
|
u'fps': None,
|
||||||
|
u'height': 360,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 630.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_2_av.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'avc1.77.30',
|
||||||
|
u'width': 640},
|
||||||
|
{ u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-993',
|
||||||
|
u'fps': None,
|
||||||
|
u'height': 450,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 993.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_1_av.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'avc1.640028',
|
||||||
|
u'width': 800},
|
||||||
|
{ u'acodec': u'mp4a.40.2',
|
||||||
|
u'ext': u'mp4',
|
||||||
|
u'format_id': u'hls-1458',
|
||||||
|
u'fps': None,
|
||||||
|
u'height': 576,
|
||||||
|
u'manifest_url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/master.m3u8?hdnea=st%3D1528898229%7Eexp%3D1528905429%7Eacl%3D%2F%2A%7Ehmac%3D7c0049dda233b54c3b960b3f56a00809756fe3d7cc69f53befcd1eca7a5eb44f',
|
||||||
|
u'preference': None,
|
||||||
|
u'protocol': u'm3u8_native',
|
||||||
|
u'tbr': 1458.0,
|
||||||
|
u'url': u'http://iviewhls-i.akamaihd.net/i/playback/_definst_/_video/ch1/CH1612H002S00MA1D1_20171215125703_,1500000,1000000,650000,500000,220000,.mp4.csmil/index_0_av.m3u8?null=0&id=AgDKn6iplmWlDfIiIVsJw%2fXW7PIsPqRgUMPQ978Sc8JvT18NlaqB9baSiasj4ERXPiwUGmBe0ROqCQ%3d%3d',
|
||||||
|
u'vcodec': u'avc1.640028',
|
||||||
|
u'width': 1024}]
|
||||||
|
|
||||||
is_live = video_params.get('livestream') == '1'
|
is_live = video_params.get('livestream') == '1'
|
||||||
if is_live:
|
if is_live:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user