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] Rename the age verification cookie #31916
Conversation
Does this solve an actual issue? I assume so, so there should either be a new or modified test for it, or just post verbose logs showing before and after. |
Sorry, I didn't see your comment. Here is the verbose output for 2 videos, with and without this path: 1 - Without: $ youtube-dl --verbose "https://www.thumbzilla.com/video/ph62ac7b29e5a39/a-girl-s-perspective-part-2-trailer"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.thumbzilla.com/video/ph62ac7b29e5a39/a-girl-s-perspective-part-2-trailer']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.10 (CPython) - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[debug] exe versions: ffmpeg 6.0, ffprobe 6.0, rtmpdump 2.4
[debug] Proxy map: {}
[PornHub] ph62ac7b29e5a39: Downloading pc webpage
[PornHub] ph62ac7b29e5a39: Downloading tv webpage
ERROR: Unable to extract encoded url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 819, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 840, in __extract_info
ie_result = ie.extract(url)
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 535, in extract
ie_result = self._real_extract(url)
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/pornhub.py", line 400, in _real_extract
js_vars = extract_js_vars(
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/pornhub.py", line 337, in extract_js_vars
assignments = self._search_regex(
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 1013, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract encoded url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. 1 - With : $ py youtube_dl/__main__.py --verbose "https://www.thumbzilla.com/video/ph62ac7b29e5a39/a-girl-s-perspective-part-2-trailer"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.thumbzilla.com/video/ph62ac7b29e5a39/a-girl-s-perspective-part-2-trailer']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 0b786108b
[debug] Python version 3.10.10 (CPython) - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[debug] exe versions: ffmpeg 6.0, ffprobe 6.0, rtmpdump 2.4
[debug] Proxy map: {}
[PornHub] ph62ac7b29e5a39: Downloading pc webpage
[PornHub] ph62ac7b29e5a39: Downloading m3u8 information
[PornHub] ph62ac7b29e5a39: Downloading m3u8 information
[PornHub] ph62ac7b29e5a39: Downloading m3u8 information
[PornHub] ph62ac7b29e5a39: Downloading m3u8 information
[PornHub] ph62ac7b29e5a39: Downloading JSON metadata
WARNING: unable to extract view count; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://ev-h.phncdn.com/hls/videos/202206/17/410097631/,1080P_4000K,720P_4000K,480P_2000K,240P_1000K,_410097631.mp4.urlset/index-f1-v1-a1.m3u8?validfrom=1680058002&validto=1680065202&ipa=86.202.209.61&hdl=-1&hash=7vVYn8Prm%2FHCIzP2CN1Q89mZa78%3D'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 10
[download] Destination: A Girl's Perspective Part 2 - TRAILER-ph62ac7b29e5a39.mp4
[download] 100% of 5.90MiB in 00:01
[debug] ffmpeg command line: ffprobe -show_streams 'file:A Girl'"'"'s Perspective Part 2 - TRAILER-ph62ac7b29e5a39.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "A Girl's Perspective Part 2 - TRAILER-ph62ac7b29e5a39.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:A Girl'"'"'s Perspective Part 2 - TRAILER-ph62ac7b29e5a39.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:A Girl'"'"'s Perspective Part 2 - TRAILER-ph62ac7b29e5a39.temp.mp4' 2 - Without $ youtube-dl --verbose "https://www.pornhub.com/view_video.php?viewkey=ph61a74c98caef3"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.pornhub.com/view_video.php?viewkey=ph61a74c98caef3']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.10 (CPython) - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[debug] exe versions: ffmpeg 6.0, ffprobe 6.0, rtmpdump 2.4
[debug] Proxy map: {}
[PornHub] ph61a74c98caef3: Downloading pc webpage
[PornHub] ph61a74c98caef3: Downloading tv webpage
ERROR: Unable to extract encoded url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 819, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 840, in __extract_info
ie_result = ie.extract(url)
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 535, in extract
ie_result = self._real_extract(url)
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/pornhub.py", line 400, in _real_extract
js_vars = extract_js_vars(
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/pornhub.py", line 337, in extract_js_vars
assignments = self._search_regex(
File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 1013, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract encoded url; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. 2 - With $ py youtube_dl/__main__.py --verbose 'https://www.pornhub.com/view_video.php?viewkey=ph61a74c98caef3'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.pornhub.com/view_video.php?viewkey=ph61a74c98caef3']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 0b786108b
[debug] Python version 3.10.10 (CPython) - Linux-6.2.8-arch1-1-x86_64-with-glibc2.37
[debug] exe versions: ffmpeg 6.0, ffprobe 6.0, rtmpdump 2.4
[debug] Proxy map: {}
[PornHub] ph61a74c98caef3: Downloading pc webpage
[PornHub] ph61a74c98caef3: Downloading m3u8 information
[PornHub] ph61a74c98caef3: Downloading m3u8 information
[PornHub] ph61a74c98caef3: Downloading m3u8 information
[PornHub] ph61a74c98caef3: Downloading JSON metadata
WARNING: unable to extract view count; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://cv-h.phncdn.com/hls/videos/202112/01/398949561/,720P_4000K,480P_2000K,240P_1000K,_398949561.mp4.urlset/index-f1-v1-a1.m3u8?v098K-Ule78xPnJI1a2j0bOy7sWumUk5TbFxBwr-2UVDc28Y0C18q3F3WlFQmGElOSWLu_akFFaKcFkqb67w4T5fp6dhwhfG9WAac49nhA-asHT726wxzrmRh5sReuRL4Bm-jgkz8dx12qrzZBJnuRcsr3uIPubYF3qmI-2lM4wxG3zgJmvyC25WrvFBOZ6VLGt_gS8OcA'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 126
[download] Destination: アニメ声 量産型にオモチャ責め-ph61a74c98caef3.mp4
[download] 100% of 109.46MiB in 00:18
[debug] ffmpeg command line: ffprobe -show_streams 'file:アニメ声 量産型にオモチャ責め-ph61a74c98caef3.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "アニメ声 量産型にオモチャ責め-ph61a74c98caef3.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:アニメ声 量産型にオモチャ責め-ph61a74c98caef3.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:アニメ声 量産型にオモチャ責め-ph61a74c98caef3.temp.mp4' Tests are broken because of a view count problem. I didn't investigate since it's not related to that PR directly. |
Are you also seeing yt-dlp/yt-dlp#4299? |
That's curious. I didn't check out yt-dlp as I assume that they will get this fix ported from here. But I suspect a geo-location issues as it mentions French ISP. Since I'm also in France, I will try from another country. |
Ok. So it's effectively a geo-location dependent behavior. Is there is a location behavior aware mechanism already implemented we can import to fix that thing ? |
What happens if you set both the original and the |
It just works. ^^ |
youtube_dl/extractor/pornhub.py
Outdated
self._set_cookie(host, 'age_verified', '1') | ||
|
||
if 'thumbzilla.com' in host: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try the version from yt-dlp/yt-dlp#4299 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I let my comment about why we set multiple cookies. ^^
Feel free to edit it.
Hello, how can I modify my file? |
@lenuxfrance |
Can it be merged? Or does it need some modification ? |
From the discussion in the yt-dlp thread, the 3 new code lines should be moved to the beginning of the |
Good idea ! I will do it by the day. |
I can confirm it work even for playlist and model page (from French IP). |
TZ Cookie doesn't seems to be needed as stated in the yt-dlp patch. Can we merge it ? |
Co-authored-by: bashonly <bashonly@bashonly.com> Co-authored-by: Noah <nkempers@outlook.de>
I adjust the commit to the version of yt-dlp and added two co-authors since they contribute at least as much as me on this PR. The modification is about a new location (Amsterdam ?) that use another cookie name. It's merged on the yt-dlp side. |
Any plan of merging this ? |
Hello ? If I can be of any help, dont hesitate. |
One month old, no news after multiple comments. |
Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
It only rename the legal age verification cookie.