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

youtube HTTPError: HTTP Error 403: Forbidden #13388

Closed
hi-august opened this issue Jun 15, 2017 · 19 comments
Closed

youtube HTTPError: HTTP Error 403: Forbidden #13388

hi-august opened this issue Jun 15, 2017 · 19 comments
Labels

Comments

@hi-august
Copy link

@hi-august hi-august commented Jun 15, 2017

(env) ➜ ~ youtube-dl -v --proxy socks5://127.0.0.1:1080/ BO5-Nl-5Rpw
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--proxy', u'socks5://127.0.0.1:1080/', u'BO5-Nl-5Rpw']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.06.12
[debug] Python version 2.7.10 - Linux-4.2.0-16-generic-x86_64-with-Ubuntu-15.10-wily
[debug] exe versions: none
[debug] Proxy map: {u'http': u'socks5://127.0.0.1:1080/', u'https': u'socks5://127.0.0.1:1080/'}
[youtube] BO5-Nl-5Rpw: Downloading webpage
[youtube] BO5-Nl-5Rpw: Downloading video info webpage
[youtube] BO5-Nl-5Rpw: Extracting video information
[youtube] BO5-Nl-5Rpw: Downloading MPD manifest
[debug] Invoking downloader on u'https://r5---sn-i3belnel.googlevideo.com/videoplayback?key=yt6&sparams=dur%2Cei%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ratebypass=yes&ip=150.129.82.175&mm=31&mn=sn-i3belnel&lmt=1493422663787407&ipbits=0&dur=331.255&itag=22&pl=24&source=youtube&expire=1497537051&mv=u&mt=1497515313&ei=u0VCWfHLC96S4QKq3JjQDw&ms=au&signature=B935778175AF27EFC63F95885A4BBED12F84612E.AE73D39B440AB2CD30925EE6C37E877062D4ADEB&requiressl=yes&id=o-ADHlPPFX2rBnJW8qhU204yUP0FVgI62mmBSc2BdW0Ou0&mime=video%2Fmp4'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
File "/home/august/.virtualenvs/env/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1826, in process_info
success = dl(filename, info_dict)
File "/home/august/.virtualenvs/env/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1768, in dl
return fd.download(name, info)
File "/home/august/.virtualenvs/env/local/lib/python2.7/site-packages/youtube_dl/downloader/common.py", line 360, in download
return self.real_download(filename, info_dict)
File "/home/august/.virtualenvs/env/local/lib/python2.7/site-packages/youtube_dl/downloader/http.py", line 61, in real_download
data = self.ydl.urlopen(request)
File "/home/august/.virtualenvs/env/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2129, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden

(env) ➜ ~

how can i fix it

@alexandreouillon
Copy link

@alexandreouillon alexandreouillon commented Jun 15, 2017

use the template https://github.com/rg3/youtube-dl/issues/new its easier for everyone

@alexandreouillon
Copy link

@alexandreouillon alexandreouillon commented Jun 15, 2017

Does the link working when you click on it behind your proxy on your browser?

@star001007
Copy link

@star001007 star001007 commented Jun 15, 2017

have the same problem.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 15, 2017

@star001007 Did you use proxies?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 15, 2017

@hi-august: What's the socks software at 127.0.0.1:1080?

@klkgogo
Copy link

@klkgogo klkgogo commented Jun 16, 2017

same issue,

@indexofire
Copy link

@indexofire indexofire commented Jun 16, 2017

me too. happened last night, visited youtube by google-chrome or dl video by youtube-dl behind shadowsocks( server in usa ) locally(china mainland), it returned 403 forbidden. After I ran youtube-dl on my server, same 403 error. So it looks like the youtube block my server ip, I guess.

@hi-august
Copy link
Author

@hi-august hi-august commented Jun 16, 2017

@yan12125 I use shadowsocks(server in hongkong), It seems youtube block my proxy ip

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 16, 2017

For all affected by 403 errors, could you run the following command and paste the output? Feel free to replace BO5-Nl-5Rpw with your favorite video ID.

curl -v "$(youtube-dl -g BO5-Nl-5Rpw -f best)" | head -c 1000 | base64
@zhangxulong
Copy link

@zhangxulong zhangxulong commented Jun 16, 2017

youtube-dl --verbose https://www.youtube.com/watch?v=fDcO1OZY1C8 [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'--verbose', u'https://www.youtube.com/watch?v=fDcO1OZY1C8'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2017.06.12 [debug] Python version 2.7.12 - Linux-4.8.0-54-generic-x86_64-with-Ubuntu-16.04-xenial [debug] exe versions: ffmpeg 2.8.11-0ubuntu0.1

@zhangxulong
Copy link

@zhangxulong zhangxulong commented Jun 16, 2017

look below plz

:~/video$ curl -v "$(youtube-dl -g fDcO1OZY1C8  -f best)" | head -c 1000 | base64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 2404:6800:400c:a::7...
* Connected to r1---sn-i3b7kn7r.googlevideo.com (2404:6800:400c:a::7) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 697 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* 	 server certificate verification OK
* 	 server certificate status verification SKIPPED
* 	 common name: *.c.docs.google.com (matched)
* 	 server certificate expiration date OK
* 	 server certificate activation date OK
* 	 certificate public key: RSA
* 	 certificate version: #3
* 	 subject: C=US,ST=California,L=Mountain View,O=Google Inc,CN=*.c.docs.google.com
* 	 start date: Wed, 07 Jun 2017 09:23:00 GMT
* 	 expire date: Wed, 30 Aug 2017 09:23:00 GMT
* 	 issuer: C=US,O=Google Inc,CN=Google Internet Authority G2
* 	 compression: NULL
* ALPN, server did not agree to a protocol
> GET /videoplayback?ei=SZtDWbfoGZHrqQG_goLAAg&ratebypass=yes&ms=au&source=youtube&signature=C612F57234A89C9BFD4A4A985012394D3ABBD118.ACC759E42B14EDC1AAE25DB84A4C9E9AB685A358&mv=u&mime=video%2Fmp4&sparams=dur%2Cei%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&dur=2690.078&itag=22&pl=48&ip=2001%3Ada8%3A8001%3A2065%3A5205%3A485%3A2af1%3A113e&key=yt6&lmt=1497531760894803&ipbits=0&requiressl=yes&id=o-ABvzdRDz3Xty-txdlwmIUmnmOBnkpzIHSSF08g26UKm1&mt=1497602468&expire=1497624489&mm=31&mn=sn-i3b7kn7r HTTP/1.1
> Host: r1---sn-i3b7kn7r.googlevideo.com
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
< Last-Modified: Wed, 02 May 2007 10:26:10 GMT
< Content-Type: text/plain
< Content-Length: 0
< Connection: close
< X-Content-Type-Options: nosniff
< Date: Fri, 16 Jun 2017 08:48:11 GMT
< Server: gvs 1.0
< 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 16, 2017

@zhangxulong
Copy link

@zhangxulong zhangxulong commented Jun 16, 2017

@yan12125

curl -v --ipv4 "$(youtube-dl -g BO5-Nl-5Rpw -f best)" | head -c 1000 | base64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 243.185.187.39...
  0     0    0     0    0     0      0      0 --:--:--  0:01:14 --:--:--     0^Z
[1]+  Stopped                 curl -v --ipv4 "$(youtube-dl -g BO5-Nl-5Rpw -f best)" | head -c 1000 | base64

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 16, 2017

@zhangxulong
Copy link

@zhangxulong zhangxulong commented Jun 17, 2017

oh maybe our edu Ipv6 address were blocked.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 17, 2017

@indexofire Could you try to disable IPv6 on the server? Maybe Shadowsocks configuration should be changed, too.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 19, 2017

@indexofire
Copy link

@indexofire indexofire commented Jun 23, 2017

之前遇到同样的问题,issue,但是今天没做设置改动忽然已经可以看视频。

curl -v --ipv4 "$(youtube-dl --proxy socks5://127.0.0.1:1080 -g BO5-Nl-5Rpw -f best)" | head -c 1000 | base64

显示的仍然是93.46.8.89这个污染的IP。彻底糊涂了。google-chrome版本 56.0.2924.87 (64-bit),另外之前我用firefox也是和chrome一样的无法放视频。

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 23, 2017

As per https://github.com/shadowsocks/shadowsocks/issues/867#issuecomment-310672607, Google no longer blocks exotic configurations like shadowsocks. I believe this issue can be closed. Feel free to leave comments below if you still got 403 errors with similar configurations (shadowsocks, Hong Kong servers, etc.) and I'll reopen.

@yan12125 yan12125 closed this Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.