projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[vevo] Sort formats (Fixes #3399)
[youtube-dl]
/
youtube_dl
/
extractor
/
arte.py
diff --git
a/youtube_dl/extractor/arte.py
b/youtube_dl/extractor/arte.py
index 2a123880e62c4154d9772ded5fb6775de50509e2..9591bad8a66254e90247a204b43b10b6db4f6406 100644
(file)
--- a/
youtube_dl/extractor/arte.py
+++ b/
youtube_dl/extractor/arte.py
@@
-2,7
+2,6
@@
from __future__ import unicode_literals
import re
from __future__ import unicode_literals
import re
-import json
from .common import InfoExtractor
from ..utils import (
from .common import InfoExtractor
from ..utils import (
@@
-26,8
+25,8
@@
class ArteTvIE(InfoExtractor):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
- video_id = mobj.group('id')
lang = mobj.group('lang')
lang = mobj.group('lang')
+ video_id = mobj.group('id')
ref_xml_url = url.replace('/videos/', '/do_delegate/videos/')
ref_xml_url = ref_xml_url.replace('.html', ',view,asPlayerXml.xml')
ref_xml_url = url.replace('/videos/', '/do_delegate/videos/')
ref_xml_url = ref_xml_url.replace('.html', ',view,asPlayerXml.xml')
@@
-40,7
+39,10
@@
class ArteTvIE(InfoExtractor):
formats = [{
'forma_id': q.attrib['quality'],
formats = [{
'forma_id': q.attrib['quality'],
- 'url': q.text,
+ # The playpath starts at 'mp4:', if we don't manually
+ # split the url, rtmpdump will incorrectly parse them
+ 'url': q.text.split('mp4:', 1)[0],
+ 'play_path': 'mp4:' + q.text.split('mp4:', 1)[1],
'ext': 'flv',
'quality': 2 if q.attrib['quality'] == 'hd' else 1,
} for q in config.findall('./urls/url')]
'ext': 'flv',
'quality': 2 if q.attrib['quality'] == 'hd' else 1,
} for q in config.findall('./urls/url')]
@@
-75,7
+77,8
@@
class ArteTVPlus7IE(InfoExtractor):
return self._extract_from_webpage(webpage, video_id, lang)
def _extract_from_webpage(self, webpage, video_id, lang):
return self._extract_from_webpage(webpage, video_id, lang)
def _extract_from_webpage(self, webpage, video_id, lang):
- json_url = self._html_search_regex(r'arte_vp_url="(.*?)"', webpage, 'json url')
+ json_url = self._html_search_regex(
+ r'arte_vp_url="(.*?)"', webpage, 'json vp url')
return self._extract_from_json_url(json_url, video_id, lang)
def _extract_from_json_url(self, json_url, video_id, lang):
return self._extract_from_json_url(json_url, video_id, lang)
def _extract_from_json_url(self, json_url, video_id, lang):
@@
-111,7
+114,7
@@
class ArteTVPlus7IE(InfoExtractor):
if not formats:
# Some videos are only available in the 'Originalversion'
# they aren't tagged as being in French or German
if not formats:
# Some videos are only available in the 'Originalversion'
# they aren't tagged as being in French or German
- if all(f['versionCode'] == 'VO' for f in all_formats):
+ if all(f['versionCode'] == 'VO'
or f['versionCode'] == 'VA'
for f in all_formats):
formats = all_formats
else:
raise ExtractorError(u'The formats list is empty')
formats = all_formats
else:
raise ExtractorError(u'The formats list is empty')
@@
-121,14
+124,17
@@
class ArteTVPlus7IE(InfoExtractor):
return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
else:
def sort_key(f):
return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
else:
def sort_key(f):
+ versionCode = f.get('versionCode')
+ if versionCode is None:
+ versionCode = ''
return (
# Sort first by quality
return (
# Sort first by quality
- int(f.get('height',-1)),
- int(f.get('bitrate',-1)),
+ int(f.get('height',
-1)),
+ int(f.get('bitrate',
-1)),
# The original version with subtitles has lower relevance
# The original version with subtitles has lower relevance
- re.match(r'VO-ST(F|A)',
f.get('versionCode', '')
) is None,
+ re.match(r'VO-ST(F|A)',
versionCode
) is None,
# The version with sourds/mal subtitles has also lower relevance
# The version with sourds/mal subtitles has also lower relevance
- re.match(r'VO?(F|A)-STM\1',
f.get('versionCode', '')
) is None,
+ re.match(r'VO?(F|A)-STM\1',
versionCode
) is None,
# Prefer http downloads over m3u8
0 if f['url'].endswith('m3u8') else 1,
)
# Prefer http downloads over m3u8
0 if f['url'].endswith('m3u8') else 1,
)
@@
-186,9
+192,10
@@
class ArteTVFutureIE(ArteTVPlus7IE):
_TEST = {
'url': 'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
'info_dict': {
_TEST = {
'url': 'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
'info_dict': {
- 'id': '
050940-003
',
+ 'id': '
5201
',
'ext': 'mp4',
'title': 'Les champignons au secours de la planète',
'ext': 'mp4',
'title': 'Les champignons au secours de la planète',
+ 'upload_date': '20131101',
},
}
},
}