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

IPv6 support #520

Closed
whatUwant opened this issue Nov 10, 2012 · 11 comments
Closed

IPv6 support #520

whatUwant opened this issue Nov 10, 2012 · 11 comments
Assignees

Comments

@whatUwant
Copy link

@whatUwant whatUwant commented Nov 10, 2012

Is it possible to force youtube-dl to work only via IPv6?
It's impossible to access Youtube via IPv4 in China without a proxy or VPN service while accessing via IPv6 has not yet been banned.
I don't know if youtube-dl chose to access youtube via IPv6 by chance. A few days ago, youtube-dl seemed to be working fine with IPv6. But recently all downloads have failed. The error message is "urlopen error [Errno 104] Connection reset by peer". I'm pretty sure there is nothing wrong with my IPv6 connectivity. The only explanation I can come up with is that youtube-dl is trying to access youtube via IPv4 right now.

@ghost ghost assigned phihag Nov 10, 2012
@phihag
Copy link
Contributor

@phihag phihag commented Nov 10, 2012

Currently, youtube-dl simply picks whatever your DNS/IP stack thinks is available, and for youtube, that's IPv6. I'll look into it, but may need to contact you personally to reproduce the issue, since I don't have any servers in China at the moment. Can you send me an email with ways to contact you (by icq/Jabber/email/phone, whatever)?

I suspect a DNS-level issue could be the problem. What do you get if you run

dig youtube.com AAAA

on your system?

@whatUwant
Copy link
Author

@whatUwant whatUwant commented Nov 10, 2012

Hello Philipp.
When I ran "dig youtube.com AAAA" I got this

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5 <<>> www.youtube.com AAAA
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27062
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;www.youtube.com.               IN      AAAA

;; ANSWER SECTION:
www.youtube.com.        23190   IN      CNAME   youtube-ui.l.google.com.
youtube-ui.l.google.com. 868    IN      CNAME   youtube-ui-china.l.google.com.

;; AUTHORITY SECTION:
l.google.com.           600     IN      SOA     ns2.google.com. dns-admin.google.com. 1502868 900 900 1800 60

;; Query time: 118 msec
;; SERVER: 202.120.127.220#53(202.120.127.220)
;; WHEN: Sun Nov 11 05:00:31 2012
;; MSG SIZE  rcvd: 148

I also queried Google's dns server 2001:4860:4860::8888

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5 <<>> www.youtube.com AAAA
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23866
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.youtube.com.               IN      AAAA

;; ANSWER SECTION:
www.youtube.com.        300     IN      AAAA    ::908a:1a45:0:0

;; Query time: 39 msec
;; SERVER: 2001:4860:4860::8888#53(2001:4860:4860::8888)
;; WHEN: Sun Nov 11 05:17:26 2012
;; MSG SIZE  rcvd: 61

I'm afraid I was wrong about my IPv6 connectivity.
It seems that dns poisoning has already been effective on IPv6.

@whatUwant
Copy link
Author

@whatUwant whatUwant commented Nov 10, 2012

I can access Youtube via HTTPS in Firefox if I manually associate correct IPv6 addresses with youtube domain names in /etc/hosts. But still, youtube-dl is not working.

@meteormatt
Copy link

@meteormatt meteormatt commented Nov 30, 2012

If you use IPv6, you should use IPv6's DNS.
For example, Google's dns server 2001:4860:4860::8888
IPv4's DNS will response IPv4 address first.

@phihag
Copy link
Contributor

@phihag phihag commented Nov 30, 2012

@meteormatt Your browser (and youtube-dl) will send A and AAAA queries in parallel, so it doesn't matter which DNS server you choose.

@dfc
Copy link

@dfc dfc commented Jul 30, 2013

I have a ipv6 tunell through huricane electric. Youtube downloads are much quicker via the tunnel than when I use straight ipv4 via my ISP. I would be interested in yt-dl having a ipv6 switch. I am currently trying to get /etc/gai.conf to prefer ipv6 for google and youtube. However that is not the most portable solution.

@SylvainBoilard
Copy link

@SylvainBoilard SylvainBoilard commented Nov 26, 2013

I second that, an option to force youtube-dl to use a particular version of the IP protocol would come in handy. I’m on a network where IPv6 connectivity is obtained through an IPv6 tunnel with a much lower data rate than what is available using IPv4, so using IPv6 to download large contents is impractical and might get annoying for other users.

@haasn
Copy link
Contributor

@haasn haasn commented Feb 1, 2014

I second that the protocol should be configurable, for similar reasons. My go-to workaround as of now is to use wget -4 -O filename $(youtube-dl -g link) but it's of course a bit bothersome to type that every time I want to download something, especially since I have to assign a filename manually.

It would be great if you could add flags like wget's -4 and -6 options manually. Alternatively, it would be great to be able to use wget in combination more easily (which is also good for stuff like --timeout, --limit-rate among other useful flags).

@kaimi
Copy link

@kaimi kaimi commented Oct 31, 2014

-4 / -6 switches would be really great 👍

@phihag phihag closed this in 500b8b4 Jan 10, 2015
@phihag
Copy link
Contributor

@phihag phihag commented Jan 10, 2015

-4 and -6 switches are present in youtube-dl 2015.01.10.1 and newer. See our FAQ if you need help updating.

@kaimi
Copy link

@kaimi kaimi commented Jan 17, 2015

Nice job, thanks!

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.