mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-09 22:27:45 +08:00
Update pornhub.py
Issue with title not being populated when download a playlist, so added title extraction for user playlists in PornHubPagedPlaylistBaseIE class.
This commit is contained in:
parent
bff90fc518
commit
8d6c3a0f15
@ -403,11 +403,17 @@ class PornHubUserIE(PornHubPlaylistBaseIE):
|
|||||||
|
|
||||||
|
|
||||||
class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE):
|
class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
host = mobj.group('host')
|
host = mobj.group('host')
|
||||||
item_id = mobj.group('id')
|
item_id = mobj.group('id')
|
||||||
|
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
host = mobj.group('host')
|
||||||
|
playlist_id = mobj.group('id')
|
||||||
|
title = ""
|
||||||
|
|
||||||
page = int_or_none(self._search_regex(
|
page = int_or_none(self._search_regex(
|
||||||
r'\bpage=(\d+)', url, 'page', default=None))
|
r'\bpage=(\d+)', url, 'page', default=None))
|
||||||
|
|
||||||
@ -423,14 +429,25 @@ class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE):
|
|||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
|
||||||
break
|
break
|
||||||
raise
|
raise
|
||||||
|
|
||||||
page_entries = self._extract_entries(webpage, host)
|
page_entries = self._extract_entries(webpage, host)
|
||||||
|
|
||||||
|
if title == "":
|
||||||
|
playlist = self._parse_json(
|
||||||
|
self._search_regex(
|
||||||
|
r'(?:playlistObject|PLAYLIST_VIEW)\s*=\s*({.+?});', webpage,
|
||||||
|
'playlist', default='{}'),
|
||||||
|
playlist_id, fatal=False)
|
||||||
|
title = playlist.get('title') or self._search_regex(
|
||||||
|
r'>Videos\s+in\s+(.+?)\s+[Pp]laylist<', webpage, 'title', fatal=False)
|
||||||
|
|
||||||
if not page_entries:
|
if not page_entries:
|
||||||
break
|
break
|
||||||
entries.extend(page_entries)
|
entries.extend(page_entries)
|
||||||
if not self._has_more(webpage):
|
if not self._has_more(webpage):
|
||||||
break
|
break
|
||||||
|
|
||||||
return self.playlist_result(orderedSet(entries), item_id)
|
return self.playlist_result(orderedSet(entries), item_id, title)
|
||||||
|
|
||||||
|
|
||||||
class PornHubPagedVideoListIE(PornHubPagedPlaylistBaseIE):
|
class PornHubPagedVideoListIE(PornHubPagedPlaylistBaseIE):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user