projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix imports and general cleanup
[youtube-dl]
/
youtube_dl
/
extractor
/
tudou.py
diff --git
a/youtube_dl/extractor/tudou.py
b/youtube_dl/extractor/tudou.py
index 3da9978b8b89365c3d92001164491298e3f508d4..161e47624b383dfe76ea1e2ea6ec73395a97db53 100644
(file)
--- a/
youtube_dl/extractor/tudou.py
+++ b/
youtube_dl/extractor/tudou.py
@@
-19,6
+19,14
@@
class TudouIE(InfoExtractor):
'title': '卡马乔国足开大脚长传冲吊集锦',
'thumbnail': 're:^https?://.*\.jpg$',
}
'title': '卡马乔国足开大脚长传冲吊集锦',
'thumbnail': 're:^https?://.*\.jpg$',
}
+ }, {
+ 'url': 'http://www.tudou.com/programs/view/ajX3gyhL0pc/',
+ 'info_dict': {
+ 'id': '117049447',
+ 'ext': 'f4v',
+ 'title': 'La Sylphide-Bolshoi-Ekaterina Krysanova & Vyacheslav Lopatin 2012',
+ 'thumbnail': 're:^https?://.*\.jpg$',
+ }
}, {
'url': 'http://www.tudou.com/albumplay/TenTw_JgiPM/PzsAs5usU9A.html',
'info_dict': {
}, {
'url': 'http://www.tudou.com/albumplay/TenTw_JgiPM/PzsAs5usU9A.html',
'info_dict': {
@@
-28,12
+36,12
@@
class TudouIE(InfoExtractor):
'skip': 'Only works from China'
}]
'skip': 'Only works from China'
}]
- def _url_for_id(self, id, quality
=
None):
- info_url = "http://v2.tudou.com/f?id="
+
str(id)
+ def _url_for_id(self, id, quality
=
None):
+ info_url = "http://v2.tudou.com/f?id="
+
str(id)
if quality:
info_url += '&hd' + quality
webpage = self._download_webpage(info_url, id, "Opening the info webpage")
if quality:
info_url += '&hd' + quality
webpage = self._download_webpage(info_url, id, "Opening the info webpage")
- final_url = self._html_search_regex('>(.+?)</f>',webpage, 'video url')
+ final_url = self._html_search_regex('>(.+?)</f>',
webpage, 'video url')
return final_url
def _real_extract(self, url):
return final_url
def _real_extract(self, url):
@@
-58,12
+66,14
@@
class TudouIE(InfoExtractor):
segments = json.loads(segs_json)
# It looks like the keys are the arguments that have to be passed as
# the hd field in the request url, we pick the higher
segments = json.loads(segs_json)
# It looks like the keys are the arguments that have to be passed as
# the hd field in the request url, we pick the higher
- quality = sorted(segments.keys())[-1]
+ # Also, filter non-number qualities (see issue #3643).
+ quality = sorted(filter(lambda k: k.isdigit(), segments.keys()),
+ key=lambda k: int(k))[-1]
parts = segments[quality]
result = []
len_parts = len(parts)
if len_parts > 1:
parts = segments[quality]
result = []
len_parts = len(parts)
if len_parts > 1:
- self.to_screen(
u
'%s: found %s parts' % (video_id, len_parts))
+ self.to_screen('%s: found %s parts' % (video_id, len_parts))
for part in parts:
part_id = part['k']
final_url = self._url_for_id(part_id, quality)
for part in parts:
part_id = part['k']
final_url = self._url_for_id(part_id, quality)