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

Force IPv4 via the Python API #22765

Closed
orion40 opened this issue Oct 19, 2019 · 5 comments
Closed

Force IPv4 via the Python API #22765

orion40 opened this issue Oct 19, 2019 · 5 comments

Comments

@orion40
Copy link

@orion40 orion40 commented Oct 19, 2019

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.08.02
[debug] Python version 3.7.3 (CPython) - Linux-4.19.0-5-amd64-x86_64-with-debian-10.1
[debug] exe versions: ffmpeg 4.1.4-1, ffprobe 4.1.4-1
[debug] Proxy map: {}

I am trying to use the youtube-dl python API. However according to the options listed here, it is not possible to do so programmatically. A quick glance at the source code didn't help find such option.

There is however the option --force-ipv4 available with the program itself. It should be possible to also do so with python, maybe like this:

yt_dl_opts = { 'format': 'bestaudio/best' 'forceip':'4' }

And so this would work as if the option -4 was supplied to youtube-dl. Of course it should also be possible to select IPv6 too.

If the option is indeed available with the API, then it should be listed in the documentation.

Thanks you for your time.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Oct 19, 2019

should be listed in the documentation

Have you even read it?

source_address: Client-side IP address to bind to.

@dstftw dstftw closed this Oct 19, 2019
@orion40
Copy link
Author

@orion40 orion40 commented Oct 19, 2019

Okay, but what is the value to set to the parameter, to force youtube-dl to use IPv4 for the download ? Using "4" output the following error:

argument of type 'int' is not iterable

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Oct 19, 2019

Do you manage reading English at all?

Client-side IP address to bind to.
IP address

@orion40
Copy link
Author

@orion40 orion40 commented Oct 19, 2019

Please update the documentation then. "--force-ipv4" is the option used for the CLI. Searching for something similar here doesn't find anything and thus is confusing. The option to choose between IPv4 and IPv6 are either "--force-ipvN" or "4" and "6". Suddenly in the API you need to give an IP address, which lack consistency. At least adding some clarification that this option indeed force IPv4 or IPv6 depending on the IP you set would be much better.

For anyone else reading this and wanting to force IPv4, use '0.0.0.0' as your IP address.

@noahbroyles
Copy link

@noahbroyles noahbroyles commented Mar 26, 2020

@orion40 Thank you! You have helped me figure out how to force IPv4.

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