Merge pull request #235 from ytdl-org/master
[pull] master from ytdl-org:master
This commit is contained in:
commit
d8dfc689f6
@ -90,8 +90,11 @@ class ORFTVthekIE(InfoExtractor):
|
|||||||
format_id = '-'.join(format_id_list)
|
format_id = '-'.join(format_id_list)
|
||||||
ext = determine_ext(src)
|
ext = determine_ext(src)
|
||||||
if ext == 'm3u8':
|
if ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
m3u8_formats = self._extract_m3u8_formats(
|
||||||
src, video_id, 'mp4', m3u8_id=format_id, fatal=False))
|
src, video_id, 'mp4', m3u8_id=format_id, fatal=False)
|
||||||
|
if any('/geoprotection' in f['url'] for f in m3u8_formats):
|
||||||
|
self.raise_geo_restricted()
|
||||||
|
formats.extend(m3u8_formats)
|
||||||
elif ext == 'f4m':
|
elif ext == 'f4m':
|
||||||
formats.extend(self._extract_f4m_formats(
|
formats.extend(self._extract_f4m_formats(
|
||||||
src, video_id, f4m_id=format_id, fatal=False))
|
src, video_id, f4m_id=format_id, fatal=False))
|
||||||
|
@ -96,7 +96,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
'repost_count': int,
|
'repost_count': int,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# not streamable song
|
# not streamable song, preview
|
||||||
{
|
{
|
||||||
'url': 'https://soundcloud.com/the-concept-band/goldrushed-mastered?in=the-concept-band/sets/the-royal-concept-ep',
|
'url': 'https://soundcloud.com/the-concept-band/goldrushed-mastered?in=the-concept-band/sets/the-royal-concept-ep',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -119,7 +119,6 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
# rtmp
|
# rtmp
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
'skip': 'Preview',
|
|
||||||
},
|
},
|
||||||
# private link
|
# private link
|
||||||
{
|
{
|
||||||
@ -346,9 +345,9 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def invalid_url(url):
|
def invalid_url(url):
|
||||||
return not url or url in format_urls or re.search(r'/(?:preview|playlist)/0/30/', url)
|
return not url or url in format_urls
|
||||||
|
|
||||||
def add_format(f, protocol):
|
def add_format(f, protocol, is_preview=False):
|
||||||
mobj = re.search(r'\.(?P<abr>\d+)\.(?P<ext>[0-9a-z]{3,4})(?=[/?])', stream_url)
|
mobj = re.search(r'\.(?P<abr>\d+)\.(?P<ext>[0-9a-z]{3,4})(?=[/?])', stream_url)
|
||||||
if mobj:
|
if mobj:
|
||||||
for k, v in mobj.groupdict().items():
|
for k, v in mobj.groupdict().items():
|
||||||
@ -361,12 +360,16 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
v = f.get(k)
|
v = f.get(k)
|
||||||
if v:
|
if v:
|
||||||
format_id_list.append(v)
|
format_id_list.append(v)
|
||||||
|
preview = is_preview or re.search(r'/(?:preview|playlist)/0/30/', f['url'])
|
||||||
|
if preview:
|
||||||
|
format_id_list.append('preview')
|
||||||
abr = f.get('abr')
|
abr = f.get('abr')
|
||||||
if abr:
|
if abr:
|
||||||
f['abr'] = int(abr)
|
f['abr'] = int(abr)
|
||||||
f.update({
|
f.update({
|
||||||
'format_id': '_'.join(format_id_list),
|
'format_id': '_'.join(format_id_list),
|
||||||
'protocol': 'm3u8_native' if protocol == 'hls' else 'http',
|
'protocol': 'm3u8_native' if protocol == 'hls' else 'http',
|
||||||
|
'preference': -10 if preview else None,
|
||||||
})
|
})
|
||||||
formats.append(f)
|
formats.append(f)
|
||||||
|
|
||||||
@ -377,7 +380,7 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
if not isinstance(t, dict):
|
if not isinstance(t, dict):
|
||||||
continue
|
continue
|
||||||
format_url = url_or_none(t.get('url'))
|
format_url = url_or_none(t.get('url'))
|
||||||
if not format_url or t.get('snipped') or '/preview/' in format_url:
|
if not format_url:
|
||||||
continue
|
continue
|
||||||
stream = self._download_json(
|
stream = self._download_json(
|
||||||
format_url, track_id, query=query, fatal=False)
|
format_url, track_id, query=query, fatal=False)
|
||||||
@ -400,7 +403,8 @@ class SoundcloudIE(InfoExtractor):
|
|||||||
add_format({
|
add_format({
|
||||||
'url': stream_url,
|
'url': stream_url,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
}, 'http' if protocol == 'progressive' else protocol)
|
}, 'http' if protocol == 'progressive' else protocol,
|
||||||
|
t.get('snipped') or '/preview/' in format_url)
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
# Old API, does not work for some tracks (e.g.
|
# Old API, does not work for some tracks (e.g.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user