aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/srf.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-04-16 20:31:02 +0600
committerSergey M․ <dstftw@gmail.com>2015-04-16 20:31:02 +0600
commit355c524bfaec10aa8f5ff31bc95d2c50ef1a3113 (patch)
tree2aaffec5922bbe0ae82c71b24c7b09020feb95fd /youtube_dl/extractor/srf.py
parentc052ce6cde53f25949c21d00e4243669f523c0a7 (diff)
[srf] Extract all formats and prefer direct links over hls and hds
Diffstat (limited to 'youtube_dl/extractor/srf.py')
-rw-r--r--youtube_dl/extractor/srf.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/youtube_dl/extractor/srf.py b/youtube_dl/extractor/srf.py
index 87b4a676a..4be329a2f 100644
--- a/youtube_dl/extractor/srf.py
+++ b/youtube_dl/extractor/srf.py
@@ -61,18 +61,25 @@ class SrfIE(InfoExtractor):
formats = []
for item in video_data.findall('./Playlists/Playlist') + video_data.findall('./Downloads/Download'):
- url_node = item.find('url')
- quality = url_node.attrib['quality']
- full_url = url_node.text
- original_ext = determine_ext(full_url)
- if original_ext == 'f4m':
- full_url += '?hdcore=3.4.0' # Without this, you get a 403 error
- formats.append({
- 'url': full_url,
- 'ext': 'mp4' if original_ext == 'm3u8' else original_ext,
- 'format_id': '%s-%s' % (quality, item.attrib['protocol']),
- 'preference': 0 if 'HD' in quality else -1,
- })
+ for url_node in item.findall('url'):
+ quality = url_node.attrib['quality']
+ full_url = url_node.text
+ original_ext = determine_ext(full_url)
+ format_id = '%s-%s' % (quality, item.attrib['protocol'])
+ if original_ext == 'f4m':
+ formats.extend(self._extract_f4m_formats(
+ full_url + '?hdcore=3.4.0', video_id, f4m_id=format_id))
+ elif original_ext == 'm3u8':
+ formats.extend(self._extract_m3u8_formats(
+ full_url, video_id, 'mp4', m3u8_id=format_id))
+ else:
+ formats.append({
+ 'url': full_url,
+ 'ext': 'mp4' if original_ext == 'm3u8' else original_ext,
+ 'format_id': format_id,
+ 'quality': 0 if 'HD' in quality else -1,
+ 'preference': 1,
+ })
self._sort_formats(formats)