From ea3c33cecb913eb6a64249dfc39ffdbf55ddc37e Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 23 Mar 2023 01:28:46 +0100 Subject: [PATCH 1/8] Rename the age verification cookie --- youtube_dl/extractor/pornhub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index e2e1500ff6e..b5e3d121872 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -265,7 +265,7 @@ def _real_extract(self, url): self._login(host) - self._set_cookie(host, 'age_verified', '1') + self._set_cookie(host, 'accessAgeDisclaimerPH', '1') def dl_webpage(platform): self._set_cookie(host, 'platform', platform) From 0b786108b525197328e0f5c1eda13fb329baa82b Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 29 Mar 2023 05:30:13 +0200 Subject: [PATCH 2/8] Add support for thumbzilla --- youtube_dl/extractor/pornhub.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index b5e3d121872..87a5673f8e7 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -265,7 +265,10 @@ def _real_extract(self, url): self._login(host) - self._set_cookie(host, 'accessAgeDisclaimerPH', '1') + if 'thumbzilla.com' in host: + self._set_cookie(host, 'accessAgeDisclaimerTZ', '1') + else: + self._set_cookie(host, 'accessAgeDisclaimerPH', '1') def dl_webpage(platform): self._set_cookie(host, 'platform', platform) From 6fb9b53e5f2e5da8af484c9b34d47d70d06f2327 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 30 Mar 2023 04:13:04 +0200 Subject: [PATCH 3/8] Update age verified cookies name logic --- youtube_dl/extractor/pornhub.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 87a5673f8e7..d511b29f26e 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -265,6 +265,11 @@ def _real_extract(self, url): self._login(host) + # The age verification cookie may have a different name based on the location. + # Setting multple cookies doesn't seem to be big deal so we prefere that solution instead + # of guessing the right cookie out of an IP we don't currently have. + self._set_cookie(host, 'age_verified', '1') + if 'thumbzilla.com' in host: self._set_cookie(host, 'accessAgeDisclaimerTZ', '1') else: From e3aa7f903f87a2183ed7037b05986342a50a801a Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 2 Apr 2023 10:26:27 +0200 Subject: [PATCH 4/8] Alway set every cookies --- youtube_dl/extractor/pornhub.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index d511b29f26e..ce2c1293b32 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -269,11 +269,8 @@ def _real_extract(self, url): # Setting multple cookies doesn't seem to be big deal so we prefere that solution instead # of guessing the right cookie out of an IP we don't currently have. self._set_cookie(host, 'age_verified', '1') - - if 'thumbzilla.com' in host: - self._set_cookie(host, 'accessAgeDisclaimerTZ', '1') - else: - self._set_cookie(host, 'accessAgeDisclaimerPH', '1') + self._set_cookie(host, 'accessAgeDisclaimerPH', '1') + self._set_cookie('thumbzilla.com', 'accessAgeDisclaimerTZ', '1') def dl_webpage(platform): self._set_cookie(host, 'platform', platform) From 9517c056ee1a69dc9b5b94759700a38621ce680c Mon Sep 17 00:00:00 2001 From: dirkf Date: Thu, 6 Apr 2023 01:34:34 +0100 Subject: [PATCH 5/8] Update comment --- youtube_dl/extractor/pornhub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index ce2c1293b32..cad0b256433 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -266,7 +266,7 @@ def _real_extract(self, url): self._login(host) # The age verification cookie may have a different name based on the location. - # Setting multple cookies doesn't seem to be big deal so we prefere that solution instead + # Setting multiple cookies doesn't seem to be big deal so we prefer that solution instead # of guessing the right cookie out of an IP we don't currently have. self._set_cookie(host, 'age_verified', '1') self._set_cookie(host, 'accessAgeDisclaimerPH', '1') From 59b81f59333f3943892904da9118b6c202fb0f87 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 12 Apr 2023 01:21:35 +0200 Subject: [PATCH 6/8] Use a function to set age cookie --- youtube_dl/extractor/pornhub.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index cad0b256433..75484f04317 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -60,6 +60,14 @@ def dl(*args, **kwargs): def _real_initialize(self): self._logged_in = False + def _set_age_cookies(self, host): + # The age verification cookie may have a different name based on the location. + # Setting multiple cookies doesn't seem to be big deal so we prefer that solution instead + # of guessing the right cookie out of an IP we don't currently have. + self._set_cookie(host, 'age_verified', '1') + self._set_cookie(host, 'accessAgeDisclaimerPH', '1') + self._set_cookie('thumbzilla.com', 'accessAgeDisclaimerTZ', '1') + def _login(self, host): if self._logged_in: return @@ -264,16 +272,9 @@ def _real_extract(self, url): video_id = mobj.group('id') self._login(host) - - # The age verification cookie may have a different name based on the location. - # Setting multiple cookies doesn't seem to be big deal so we prefer that solution instead - # of guessing the right cookie out of an IP we don't currently have. - self._set_cookie(host, 'age_verified', '1') - self._set_cookie(host, 'accessAgeDisclaimerPH', '1') - self._set_cookie('thumbzilla.com', 'accessAgeDisclaimerTZ', '1') + self._set_age_cookies(host) def dl_webpage(platform): - self._set_cookie(host, 'platform', platform) return self._download_webpage( 'https://www.%s/view_video.php?viewkey=%s' % (host, video_id), video_id, 'Downloading %s webpage' % platform) @@ -569,6 +570,7 @@ def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) user_id = mobj.group('id') videos_url = '%s/videos' % mobj.group('url') + self._set_age_cookies(mobj.group('host')) page = self._extract_page(url) if page: videos_url = update_url_query(videos_url, {'page': page}) @@ -633,6 +635,7 @@ def _real_extract(self, url): item_id = mobj.group('id') self._login(host) + self._set_age_cookies(host) return self.playlist_result(self._entries(url, host, item_id), item_id) From aefed08d32f4eec54b13766d577ed17d87507609 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 17 Apr 2023 04:30:45 +0200 Subject: [PATCH 7/8] TZ cookie doesn't seems to be needed --- youtube_dl/extractor/pornhub.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 75484f04317..294c27a0d3e 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -66,7 +66,6 @@ def _set_age_cookies(self, host): # of guessing the right cookie out of an IP we don't currently have. self._set_cookie(host, 'age_verified', '1') self._set_cookie(host, 'accessAgeDisclaimerPH', '1') - self._set_cookie('thumbzilla.com', 'accessAgeDisclaimerTZ', '1') def _login(self, host): if self._logged_in: From 60ac3a6f856a2f16482e6f388706b998a09c33b0 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 26 Apr 2023 04:54:31 +0200 Subject: [PATCH 8/8] [PATCH] Set `accessPH` cookie Co-authored-by: bashonly Co-authored-by: Noah --- youtube_dl/extractor/pornhub.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 294c27a0d3e..130e42866ee 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -66,6 +66,7 @@ def _set_age_cookies(self, host): # of guessing the right cookie out of an IP we don't currently have. self._set_cookie(host, 'age_verified', '1') self._set_cookie(host, 'accessAgeDisclaimerPH', '1') + self._set_cookie(host, 'accessPH', '1') def _login(self, host): if self._logged_in: