Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Pornhub] Cannot download private videos even with --cookies #15697
Comments
|
Please use this account:
|
|
Yeah I really don't get it. I can't manage to log in programmatically at all. I copied Firefox's requests exactly as curl commands, only substituting the random token, and yet still it rejects my login attempt, giving "Session timed out - reload and try again". Script below:
Is there something other than headers, cookies, and POST data that needs to be faked? |
|
This patch fixes it diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py
index 281a4f05e..5afa35dd2 100644
--- a/youtube_dl/extractor/pornhub.py
+++ b/youtube_dl/extractor/pornhub.py
@@ -116,11 +116,11 @@ class PornHubIE(InfoExtractor):
video_id = self._match_id(url)
def dl_webpage(platform):
+ self._set_cookie('pornhub.com', 'age_verified', '1')
+ self._set_cookie('pornhub.com', 'platform', platform)
return self._download_webpage(
'http://www.pornhub.com/view_video.php?viewkey=%s' % video_id,
- video_id, headers={
- 'Cookie': 'age_verified=1; platform=%s' % platform,
- })
+ video_id)
webpage = dl_webpage('pc')using a
it works fine |
|
Oh, yes that fixes this issue. Will you make a pull request? |
|
I'm new to github and I was wondering if anyone can walk me through applying this patch |
|
Guys i really need an help please i downloaded youtube-dl, now i can use it with the cmd but how can i use the patch and the cookies? i'm stuck |
So, how do you apply the patch? |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like this:[x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2018.02.22. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:
Add the
-vflag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):cookies.txt (just as an example):
Description of your issue, suggested solution and other information
I logged in from Firefox, verified that I can watch the video, exported my cookies and fed the resulting cookies.txt to youtube-dl, yet it still says "You must be friends with so-and-so".
Here are the credentials for the video if anybody wants to use it to test:
For a Youtube private video the --cookies argument does work. According to #8603, --cookies did work with Pornhub as of 2016-02-16. Also, curl does work with the same cookies.txt (
curl -b cookies.txt https://www.pornhub.com/view_video.php?viewkey=ph5a91d5f3709a8 | grep mediastring) so maybe I'm just doing something wrong.