aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-04-22 22:11:37 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2017-04-22 22:11:37 +0800
commitfbf56be213021669363b69c5d0866b2cf22ecf2a (patch)
tree4cf69fb91e4bbceb7866e94e1188ab1a29a4fb98 /youtube_dl
parent54f54fcca7af7e5bbc779cfc73d58d1ed2b4b6ae (diff)
[iqiyi] Fix playlist detection (#12504)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/iqiyi.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/youtube_dl/extractor/iqiyi.py b/youtube_dl/extractor/iqiyi.py
index 2af6a6db4..8a711afb9 100644
--- a/youtube_dl/extractor/iqiyi.py
+++ b/youtube_dl/extractor/iqiyi.py
@@ -337,13 +337,16 @@ class IqiyiIE(InfoExtractor):
url, 'temp_id', note='download video page')
# There's no simple way to determine whether an URL is a playlist or not
- # So detect it
- playlist_result = self._extract_playlist(webpage)
- if playlist_result:
- return playlist_result
-
+ # Sometimes there are playlist links in individual videos, so treat it
+ # as a single video first
tvid = self._search_regex(
- r'data-player-tvid\s*=\s*[\'"](\d+)', webpage, 'tvid')
+ r'data-player-tvid\s*=\s*[\'"](\d+)', webpage, 'tvid', default=None)
+ if tvid is None:
+ playlist_result = self._extract_playlist(webpage)
+ if playlist_result:
+ return playlist_result
+ raise ExtractorError('Can\'t find any video')
+
video_id = self._search_regex(
r'data-player-videoid\s*=\s*[\'"]([a-f\d]+)', webpage, 'video_id')