From c7b455b9b4848877f2e89d5ae93f2ba4a37862c4 Mon Sep 17 00:00:00 2001 From: random-dev-42938 <40475165+random-dev-42938@users.noreply.github.com> Date: Thu, 21 Jun 2018 23:23:03 +0200 Subject: [PATCH 1/2] Fix for issue 16262 Playlist loading initialize the 'platform' cookie on the domain '.pornhub.com' (with initial dot) This messes up with the loading of the tv_webpage that specifies another value for the 'platform' cookie but on the 'pornhub.com' domain (no initial dot) Fix is to clear the .pornhub.com domain cookies --- youtube_dl/extractor/pornhub.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 23e24d216..8c63cf9b5 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -115,6 +115,9 @@ class PornHubIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) + # playlist loading can lead to cookies here, interferring with platform settings + self._downloader.cookiejar.clear('.pornhub.com') + self._set_cookie('pornhub.com', 'age_verified', '1') def dl_webpage(platform): From fd544ee5b6d1abe48a09b4ce444ac742492986d0 Mon Sep 17 00:00:00 2001 From: random-dev-42938 <40475165+random-dev-42938@users.noreply.github.com> Date: Sat, 23 Jun 2018 00:26:42 +0200 Subject: [PATCH 2/2] Fix for 16262 that does not break single video loading... Moved the fix to the end of the playlist loading/user loading --- youtube_dl/extractor/pornhub.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 8c63cf9b5..e308175af 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -115,9 +115,6 @@ class PornHubIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - # playlist loading can lead to cookies here, interferring with platform settings - self._downloader.cookiejar.clear('.pornhub.com') - self._set_cookie('pornhub.com', 'age_verified', '1') def dl_webpage(platform): @@ -262,6 +259,9 @@ class PornHubPlaylistBaseIE(InfoExtractor): title = playlist.get('title') or self._search_regex( r'>Videos\s+in\s+(.+?)\s+[Pp]laylist<', webpage, 'title', fatal=False) + # list loading can lead to cookies in .pornhub.com, interferring with platform settings when loading the pages + self._downloader.cookiejar.clear('.pornhub.com') + return self.playlist_result( entries, playlist_id, title, playlist.get('description')) @@ -334,4 +334,7 @@ class PornHubUserVideosIE(PornHubPlaylistBaseIE): break entries.extend(page_entries) + # list loading can lead to cookies in .pornhub.com, interferring with platform settings when loading the pages + self._downloader.cookiejar.clear('.pornhub.com') + return self.playlist_result(entries, user_id)