This commit is contained in:
Thomas Christlieb 2020-10-03 17:07:45 -07:00 committed by GitHub
commit a09f07ae79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -19,6 +19,7 @@ from ..utils import (
ExtractorError,
ohdave_rsa_encrypt,
remove_start,
extract_attributes,
)
@ -306,10 +307,14 @@ class IqiyiIE(InfoExtractor):
def _extract_playlist(self, webpage):
PAGE_SIZE = 50
links = re.findall(
r'<a[^>]+class="site-piclist_pic_link"[^>]+href="(http://www\.iqiyi\.com/.+\.html)"',
webpage)
if not links:
links = []
for link in re.findall(r'<a[^>]+class="[^"]*site-piclist_pic_link[^"]*"[^>]*>', webpage):
attribs = extract_attributes(link)
# It must be a valid url, and links on the playlist page have NO title-Attribute in them
# (links to other videos on the video page have, so beware of that!)
if attribs['href'].startswith('http') and 'title' not in attribs:
links.append(attribs['href'])
if len(links) == 0:
return
album_id = self._search_regex(
@ -328,10 +333,13 @@ class IqiyiIE(InfoExtractor):
errnote='Failed to download playlist page %d' % page_num)
pagelist = self._parse_json(
remove_start(pagelist_page, 'var tvInfoJs='), album_id)
vlist = pagelist['data']['vlist']
for item in vlist:
entries.append(self.url_result(item['vurl']))
if len(vlist) < PAGE_SIZE:
if 'data' in pagelist:
vlist = pagelist['data']['vlist']
for item in vlist:
entries.append(self.url_result(item['vurl']))
if len(vlist) < PAGE_SIZE:
break
else:
break
return self.playlist_result(entries, album_id, album_title)