mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-24 18:11:01 +01:00
[tudou] Modernize
This commit is contained in:
parent
d434ca5448
commit
141ba36996
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
@ -46,13 +43,10 @@ class TudouIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
m = re.search(r'vcode:\s*[\'"](.+?)[\'"]', webpage)
|
youku_vcode = self._search_regex(
|
||||||
if m and m.group(1):
|
r'vcode:\s*[\'"](.+?)[\'"]', webpage, 'youku vcode', default=None)
|
||||||
return {
|
if youku_vcode:
|
||||||
'_type': 'url',
|
return self.url_result('youku:' + youku_vcode, ie='Youku')
|
||||||
'url': 'youku:' + m.group(1),
|
|
||||||
'ie_key': 'Youku'
|
|
||||||
}
|
|
||||||
|
|
||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
r",kw:\s*['\"](.+?)[\"']", webpage, 'title')
|
r",kw:\s*['\"](.+?)[\"']", webpage, 'title')
|
||||||
@ -63,8 +57,8 @@ class TudouIE(InfoExtractor):
|
|||||||
r"playerUrl\s*:\s*['\"](.+?\.swf)[\"']",
|
r"playerUrl\s*:\s*['\"](.+?\.swf)[\"']",
|
||||||
webpage, 'player URL', default=self._PLAYER_URL)
|
webpage, 'player URL', default=self._PLAYER_URL)
|
||||||
|
|
||||||
segs_json = self._search_regex(r'segs: \'(.*)\'', webpage, 'segments')
|
segments = self._parse_json(self._search_regex(
|
||||||
segments = json.loads(segs_json)
|
r'segs: \'(.*)\'', webpage, 'segments'), video_id)
|
||||||
# It looks like the keys are the arguments that have to be passed as
|
# 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
|
# the hd field in the request url, we pick the higher
|
||||||
# Also, filter non-number qualities (see issue #3643).
|
# Also, filter non-number qualities (see issue #3643).
|
||||||
|
Loading…
Reference in New Issue
Block a user