Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pornhub] Unable to extract encoded url (part 2) #7590

Closed
11 tasks done
zhong-yiyu opened this issue Jul 14, 2023 · 5 comments · Fixed by #7591
Closed
11 tasks done

[Pornhub] Unable to extract encoded url (part 2) #7590

zhong-yiyu opened this issue Jul 14, 2023 · 5 comments · Fixed by #7591
Labels
NSFW patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website

Comments

@zhong-yiyu
Copy link
Contributor

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Region

United Kingdom

Provide a description that is worded well enough to be understood

Using the most simple instruction, just yt-dlp <url>, when entering an pornhub video's URL. The yt-dlp tool reports error and not downloading the video.
Also, when using it to download a model's entire collection on its personal page, the application returns 0 videos found on the page.

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['https://pornhub.com/view_video.php?viewkey=648ef5ef97f9e', '-v']
[debug] Encodings: locale cp936, fs utf-8, pref cp936, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.07.13.203938 [8a4cd12c8] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2023-05-25-git-944243477b-full_build-www.gyan.dev (setts), ffprobe 2023-05-25-git-944243477b-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[PornHub] Extracting URL: https://pornhub.com/view_video.php?viewkey=648ef5ef97f9e
[PornHub] 648ef5ef97f9e: Downloading pc webpage
[PornHub] 648ef5ef97f9e: Downloading tv webpage
ERROR: [PornHub] 648ef5ef97f9e: Unable to extract encoded url; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "yt_dlp\extractor\common.py", line 710, in extract
  File "yt_dlp\extractor\pornhub.py", line 407, in _real_extract
  File "yt_dlp\extractor\pornhub.py", line 344, in extract_js_vars
  File "yt_dlp\extractor\common.py", line 1258, in _search_regex
@zhong-yiyu zhong-yiyu added site-bug Issue with a specific website triage Untriaged issue labels Jul 14, 2023
@bashonly bashonly added the NSFW label Jul 14, 2023
@bashonly
Copy link
Member

bashonly commented Jul 14, 2023

Error is the same as #4299, which makes me think it could be a cookies issue. I can't reproduce the issue, which makes me think this could be a regional issue (again like #4299)

@zhong-yiyu Could you open a private browsing tab in your browser, visit the video page, and share the cookies that are set for the site? (dev tools => Storage => Cookies) You can just copy/paste the names and values of the cookies

@bashonly bashonly added cant-reproduce The issue cannot be reliably reproduced and removed triage Untriaged issue labels Jul 14, 2023
@zhong-yiyu
Copy link
Contributor Author

I tried open the URL : https://cn.pornhub.com/view_video.php?viewkey=648ef5ef97f9e
The Cookie in private browsing mode are key-values of:

{
atatusScript : hide,
accessAgeDisclaimerUK : 1,
ss : 968203689547508326,
__l : 64B179E2-42FE722901BB108D-A2C6D8E,
ua : 14d58a1ba286f087d9736249ec785314,
fg_0d2ec4cbd943df07ec161982a603817e : 39610.100000,
bs : fiqr437ls0n69njmj0urcsvhk1p4llgp,
__s : 64B179E2-42FE722901BB108D-A2C6D8E,
platform : pc
}

@bashonly
Copy link
Member

I think this would fix it

diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py
index 2f5a572a5..11c14d08f 100644
--- a/yt_dlp/extractor/pornhub.py
+++ b/yt_dlp/extractor/pornhub.py
@@ -61,6 +61,7 @@ def _real_initialize(self):
     def _set_age_cookies(self, host):
         self._set_cookie(host, 'age_verified', '1')
         self._set_cookie(host, 'accessAgeDisclaimerPH', '1')
+        self._set_cookie(host, 'accessAgeDisclaimerUK', '1')
         self._set_cookie(host, 'accessPH', '1')
 
     def _login(self, host):

@bashonly bashonly added patch-available There is patch available that should fix this issue. Someone needs to make a PR with it needs-testing Patch needs testing and removed cant-reproduce The issue cannot be reliably reproduced labels Jul 14, 2023
@zhong-yiyu
Copy link
Contributor Author

Amazing! This change really makes the download working again!
May I create a branch to merge this change? Or should you do it?

@bashonly
Copy link
Member

@zhong-yiyu you can open a PR

@bashonly bashonly removed the needs-testing Patch needs testing label Jul 14, 2023
@bashonly bashonly changed the title [Pornhub] Download not working [Pornhub] Unable to extract encoded url (part 2) Jul 14, 2023
@bashonly bashonly linked a pull request Jul 14, 2023 that will close this issue
9 tasks
bashonly pushed a commit that referenced this issue Jul 15, 2023
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this issue Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NSFW patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants