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

Does the "--source-address" works for IPv6? #4696

Closed
firmanelhakim opened this issue Jan 14, 2015 · 13 comments
Closed

Does the "--source-address" works for IPv6? #4696

firmanelhakim opened this issue Jan 14, 2015 · 13 comments

Comments

@firmanelhakim
Copy link

@firmanelhakim firmanelhakim commented Jan 14, 2015

Hi,

Does the "--source-address" works for IPv6? I have several IPv6 addresses assigned to my VPS. And I would like to change the outgoing IPv6 that used by youtube-dl.

chiman@ramnode:~/workspace$ ip -6 addr show | grep "scope global"
    inet6 2604:180:1::e2b5:5329/128 scope global
    inet6 2604:180:1::38ae:9b2b/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global
    inet6 2604:180:1::?:?/128 scope global

chiman@ramnode:~/workspace$ youtube-dl --version
2015.01.11

chiman@ramnode:~/workspace$ youtube-dl -g -v https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::e2b5:5329
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-g', '-v', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::e2b5:5329']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.3 - Linux-2.6.32-042stab093.5-i686-with-debian-7.7
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?itag=22&mt=1421220562&fexp=900718%2C901802%2C924619%2C927622%2C932404%2C938648%2C9405792%2C9405908%2C941004%2C943917%2C947209%2C947218%2C947225%2C948124%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701&upn=FpntL38JBdU&key=yt5&ipbits=0&ratebypass=yes&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AJudc2ancQ59OtSAlJLeauLjHsnUC3gqryZlDbfw6ava&ms=au&gcr=us&mv=m&expire=1421242234&sver=3&requiressl=yes&ip=2604%3A180%3A1%3A%3Ae2b5%3A5329&mime=video%2Fmp4&initcwndbps=10472500&dur=212.718&source=youtube&mm=31&signature=B304AE758A3530E22BE3CE51CF43E94314A82A35.861AB3FC23F2F5478DA169239978F3887B06AFF1

chiman@ramnode:~/workspace$ youtube-dl -g -v https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::38ae:9b2b
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-g', '-v', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::38ae:9b2b']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.3 - Linux-2.6.32-042stab093.5-i686-with-debian-7.7
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?id=o-AJZelLXOioBSk6jvM85ttO9g1lVf2Z6Y74Uc7I5AWZS5&dur=212.718&mt=1421220627&mv=m&ms=au&ip=2604%3A180%3A1%3A%3Ae2b5%3A5329&mm=31&itag=22&sver=3&fexp=900718%2C916943%2C924628%2C927622%2C932404%2C939975%2C9405768%2C9406071%2C941004%2C942805%2C943917%2C945125%2C947209%2C947218%2C947225%2C948124%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701&ipbits=0&ratebypass=yes&requiressl=yes&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&initcwndbps=10472500&gcr=us&source=youtube&mime=video%2Fmp4&key=yt5&upn=28-WaRNmkw4&expire=1421242255&signature=10EA8A864A5B2868C13E8D1E659267D8862ED0E8.BEE8A59F8455E79C6662E752B7A6D6656242672E

How can I know if it's working or not?

Thanks.

@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

Yes, the option works with IPv4 and IPv6. Pass in -Cv to see your public IP address with the given options.

@phihag phihag closed this Jan 14, 2015
@firmanelhakim
Copy link
Author

@firmanelhakim firmanelhakim commented Jan 14, 2015

Here's the output for -Cv

chiman@ramnode:~/workspace$ youtube-dl -g -Cv https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::e2b5:5329
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-g', '-Cv', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::e2b5:5329']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.3 - Linux-2.6.32-042stab093.5-i686-with-debian-7.7
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
[debug] Public IP address: 2604:180:1::e2b5:5329
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?ms=au&mv=m&source=youtube&fexp=900718%2C922247%2C927622%2C932404%2C934601%2C9406144%2C941004%2C943917%2C945073%2C947209%2C947218%2C947225%2C948124%2C948703%2C950505%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701&ip=2604%3A180%3A1%3A%3Ae2b5%3A5329&key=yt5&initcwndbps=4773750&gcr=us&id=o-APtY51JOl1BJ_uOLyp8MfjOISqM25hkk-ZEsdOMYhFzv&dur=212.718&upn=5utSTrYelj4&mm=31&mime=video%2Fmp4&mt=1421224141&itag=22&requiressl=yes&sver=3&expire=1421245774&ipbits=0&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ratebypass=yes&signature=BDFBD82AE0B06C1C1AC1A86AA42E45C58B38A3E9.E35BB0FF4E117CE9C58BADA8071ADC9A164DE877

chiman@ramnode:~/workspace$ youtube-dl -g -Cv https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::38ae:9b2b
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-g', '-Cv', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::38ae:9b2b']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.3 - Linux-2.6.32-042stab093.5-i686-with-debian-7.7
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
[debug] Public IP address: 2604:180:1::e2b5:5329
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?mv=m&fexp=900233%2C900718%2C912820%2C913438%2C927622%2C932404%2C9405148%2C941004%2C943917%2C947209%2C947218%2C947225%2C948124%2C949006%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701&mt=1421224141&ms=au&id=o-AAK2AtGqWI1KHdCvb9B4zgXstaG7mnqLTz2Yq9GWsHrI&expire=1421245790&key=yt5&sver=3&ip=2604%3A180%3A1%3A%3Ae2b5%3A5329&ipbits=0&ratebypass=yes&source=youtube&mm=31&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&upn=S12RYBNhXsM&itag=22&requiressl=yes&initcwndbps=4773750&gcr=us&mime=video%2Fmp4&dur=212.718&signature=9EB35011F626BF43E95C7DF7A2DEE2B6A601E7FD.6D52AA5C91B53098E0BDCB7D3396A54F3BD8F7A6

Both commands shows the same Public IP address, which is: 2604:180:1::e2b5:5329

@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

What output do you get when you run

curl --interface 2604:180:1::e2b5:5329 yt-dl.org/ip
curl --interface 2604:180:1::38ae:9b2b yt-dl.org/ip

Can you upload the file strace.log you get when running

strace -o strace.log -s 1000 -f youtube-dl -Cv --source-address 2604:180:1::e2b5:5329 http://yt-dl.org/ip

somewhere?

@phihag phihag reopened this Jan 14, 2015
@firmanelhakim
Copy link
Author

@firmanelhakim firmanelhakim commented Jan 14, 2015

Here's the output you asked.

chiman@ramnode:~/workspace$ curl --interface 2604:180:1::e2b5:5329 yt-dl.org/ip
2604:180:1::e2b5:5329

chiman@ramnode:~/workspace$ curl --interface 2604:180:1::38ae:9b2b yt-dl.org/ip
2604:180:1::38ae:9b2b

And here's the strace.log

@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

Is that the whole strace log? It looks somewhat cut short. The end should really be along the lines of

23935 exit_group(0)                     = ?
23935 +++ exited with 0 +++
(END)
@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

Oh, my mistake, GitHub just truncates it. Here's the full version.

@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

According to the strace log, youtube-dl outputted

3354  write(2, "[debug] Public IP address: 2604:180:1::e2b5:5329\n", 49) = 49

so it seems to work just fine.

Oh, I apologize, that was the address that did work. I'm gonna need the strace log for

strace -o strace.log -s 1000 -f youtube-dl -Cv --source-address 2604:180:1::38ae:9b2b http://yt-dl.org/ip

I'm sorry for the needless confusion.

@firmanelhakim
Copy link
Author

@firmanelhakim firmanelhakim commented Jan 14, 2015

Here's a new one, strace_9b2b.log.

@phihag
Copy link
Contributor

@phihag phihag commented Jan 14, 2015

That's quite curious indeed. The final download does work with the correct IP, but the debugging output does not, and does some strange UDP things. I'll investigate.

@firmanelhakim
Copy link
Author

@firmanelhakim firmanelhakim commented Jan 14, 2015

Great. Should you need more information from my local environment, just say it. Thanks.

@firmanelhakim
Copy link
Author

@firmanelhakim firmanelhakim commented Jan 15, 2015

@phihag

Recently, you made the latest commit [ssl] Correct connect creation and there's a link to SERVER_AUTH.

I switched the Documentation for 2.7, it says New in version 2.7.9.

Previously, I used Python 2.7.3. And just now, I updated to Python 2.7.9, then I try again the --source-address

And these are the results:

chiman@ramnode:~/workspace$ youtube-dl -Cvg https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::e2b5:5329
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-Cvg', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::e2b5:5329']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.9 - Linux-2.6.32-042stab093.5-i686-with-debian-7.8
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
[debug] Public IP address: 2604:180:1::e2b5:5329
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?dur=212.718&ms=au&fexp=900237%2C900718%2C904732%2C907263%2C924627%2C927622%2C941004%2C943917%2C947209%2C947225%2C948124%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C958600%2C959701&mt=1421299331&mv=m&mm=31&source=youtube&upn=HAViEyAQssY&id=o-AP-18LYPTOqB65MQh8qU5hWToBSxloUd4qHUoXevFLR5&sparams=cwbhb%2Cdur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ratebypass=yes&initcwndbps=3331250&cwbhb=yes&ip=2604%3A180%3A1%3A%3Ae2b5%3A5329&requiressl=yes&sver=3&pl=48&gcr=us&expire=1421320957&mime=video%2Fmp4&key=yt5&itag=22&ipbits=0&signature=25B33C8606333C1C48B12CD1DAABCA93325115C1.459FFDE022AD53DF162A8F898E49F34A312632AE

chiman@ramnode:~/workspace$ youtube-dl -Cvg https://www.youtube.com/watch?v=Q33SoblaZbU --source-address 2604:180:1::38ae:9b2b
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-Cvg', 'https://www.youtube.com/watch?v=Q33SoblaZbU', '--source-address', '2604:180:1::38ae:9b2b']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.01.11
[debug] Python version 2.7.9 - Linux-2.6.32-042stab093.5-i686-with-debian-7.8
[debug] exe versions: avconv N-68853-g91bdb24, ffmpeg N-68853-g91bdb24, ffprobe N-68853-g91bdb24, rtmpdump 2.4
[debug] Proxy map: {}
[debug] Public IP address: 2604:180:1::38ae:9b2b
https://r11---sn-nx57ynez.googlevideo.com/videoplayback?ratebypass=yes&mt=1421299331&mv=m&ms=au&gcr=us&source=youtube&itag=22&initcwndbps=3331250&mm=31&sver=3&id=o-AAk64nNr8SKke-DBRUT7FNj66sZGfXxA5OZgiDplXsi7&requiressl=yes&upn=zQFfn970UrM&ipbits=0&expire=1421320973&fexp=900718%2C902543%2C905639%2C907263%2C927622%2C931361%2C940927%2C941004%2C943917%2C947209%2C947225%2C948124%2C952302%2C952605%2C952807%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701&mime=video%2Fmp4&key=yt5&sparams=dur%2Cgcr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ip=2604%3A180%3A1%3A%3A38ae%3A9b2b&pl=48&dur=212.718&signature=B962C79613704120504634739DC77AD34026722F.F3ED5A0961964FC12B0D656069386FCF972513

As you can see, now the debugging output is correct.

[debug] Public IP address: 2604:180:1::e2b5:5329
[debug] Public IP address: 2604:180:1::38ae:9b2b

Problem solved. Thanks. 👍

@phihag
Copy link
Contributor

@phihag phihag commented Jan 15, 2015

Thank you very much for the detailed debugging information! I can reproduce the problem with an older Python 2.7 version. I'm therefore reopening this issue - we should fix, work around, or at least warn then.

@phihag
Copy link
Contributor

@phihag phihag commented Jan 23, 2015

Fixed in youtube-dl 2015.01.23.2 and newer. See our FAQ if you need help updating.

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
2 participants
You can’t perform that action at this time.