1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-02 18:39:29 +00:00
This commit is contained in:
Thomas Christlieb 2023-09-05 22:16:41 +08:00 committed by GitHub
commit 2b647b9553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)