mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
[extractor/pornhub] Set access cookies to fix extraction (#6685)
Closes #4299 Authored by: Schmoaaaaah, arobase-che Co-authored-by: Noah <nkempers@outlook.de> Co-authored-by: ache <ache@ache.one>
This commit is contained in:
parent
0c4e0fbcad
commit
62beefa818
@ -58,6 +58,11 @@ def dl(*args, **kwargs):
|
|||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
self._logged_in = False
|
self._logged_in = False
|
||||||
|
|
||||||
|
def _set_age_cookies(self, host):
|
||||||
|
self._set_cookie(host, 'age_verified', '1')
|
||||||
|
self._set_cookie(host, 'accessAgeDisclaimerPH', '1')
|
||||||
|
self._set_cookie(host, 'accessPH', '1')
|
||||||
|
|
||||||
def _login(self, host):
|
def _login(self, host):
|
||||||
if self._logged_in:
|
if self._logged_in:
|
||||||
return
|
return
|
||||||
@ -267,8 +272,7 @@ def _real_extract(self, url):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
self._login(host)
|
self._login(host)
|
||||||
|
self._set_age_cookies(host)
|
||||||
self._set_cookie(host, 'age_verified', '1')
|
|
||||||
|
|
||||||
def dl_webpage(platform):
|
def dl_webpage(platform):
|
||||||
self._set_cookie(host, 'platform', platform)
|
self._set_cookie(host, 'platform', platform)
|
||||||
@ -569,6 +573,7 @@ def _real_extract(self, url):
|
|||||||
mobj = self._match_valid_url(url)
|
mobj = self._match_valid_url(url)
|
||||||
user_id = mobj.group('id')
|
user_id = mobj.group('id')
|
||||||
videos_url = '%s/videos' % mobj.group('url')
|
videos_url = '%s/videos' % mobj.group('url')
|
||||||
|
self._set_age_cookies(mobj.group('host'))
|
||||||
page = self._extract_page(url)
|
page = self._extract_page(url)
|
||||||
if page:
|
if page:
|
||||||
videos_url = update_url_query(videos_url, {'page': page})
|
videos_url = update_url_query(videos_url, {'page': page})
|
||||||
@ -633,6 +638,7 @@ def _real_extract(self, url):
|
|||||||
item_id = mobj.group('id')
|
item_id = mobj.group('id')
|
||||||
|
|
||||||
self._login(host)
|
self._login(host)
|
||||||
|
self._set_age_cookies(host)
|
||||||
|
|
||||||
return self.playlist_result(self._entries(url, host, item_id), item_id)
|
return self.playlist_result(self._entries(url, host, item_id), item_id)
|
||||||
|
|
||||||
@ -812,5 +818,6 @@ def _real_extract(self, url):
|
|||||||
item_id = mobj.group('id')
|
item_id = mobj.group('id')
|
||||||
|
|
||||||
self._login(host)
|
self._login(host)
|
||||||
|
self._set_age_cookies(host)
|
||||||
|
|
||||||
return self.playlist_result(self._entries(mobj.group('url'), host, item_id), item_id)
|
return self.playlist_result(self._entries(mobj.group('url'), host, item_id), item_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user