0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[iqiyi] Simplify and improve regex patterns

See the comments in #5849
This commit is contained in:
Yen Chi Hsuan 2015-06-07 00:56:08 +08:00
parent 7012620e2b
commit 29e7e0781b

View file

@ -161,12 +161,11 @@ def _real_extract(self, url):
webpage = self._download_webpage(
url, 'temp_id', note='download video page')
tvid = self._search_regex(
r'tvId ?= ?(\'|\")(?P<tvid>\d+)', webpage, 'tvid', flags=re.I, group='tvid')
r'data-player-tvid\s*=\s*[\'"](\d+)', webpage, 'tvid')
video_id = self._search_regex(
r'videoId ?= ?(\'|\")(?P<video_id>[a-z\d]+)',
webpage, 'video_id', flags=re.I, group='video_id')
r'data-player-videoid\s*=\s*[\'"]([a-f\d]+)', webpage, 'video_id')
swf_url = self._search_regex(
r'(?P<swf>http://.+?MainPlayer.+?\.swf)', webpage, 'swf')
r'(http://.+?MainPlayer.+?\.swf)', webpage, 'swf player URL')
_uuid = uuid.uuid4().hex
enc_key = self.get_enc_key(swf_url, video_id)