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

Add multiple link generation in a single command #5209

Closed
TheGr33k opened this issue Mar 15, 2015 · 7 comments
Closed

Add multiple link generation in a single command #5209

TheGr33k opened this issue Mar 15, 2015 · 7 comments

Comments

@TheGr33k
Copy link

@TheGr33k TheGr33k commented Mar 15, 2015

It would be nice for youtube-dl to to be able to generate multiple direct links for different quality of the same video

for e.g youtube-dl -g -f 18 22 43 https://www.youtube.com/watch?v=NrXdauEv9HY

would generate urls for the different itags.Each url could be separated by a special character in the output.

Advantages

No need to call youtube-dl multiple times for different qualities of the same video will save CPU and decrease the chance of getting Too Many request as the same page won't be requested from youtube multiple times.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 15, 2015

Just use --dump-json .

@dstftw dstftw closed this Mar 15, 2015
@TheGr33k
Copy link
Author

@TheGr33k TheGr33k commented Mar 15, 2015

It should works but a cleaner version would be better.There is a lot of info that is not needed

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 15, 2015

All this info is extracted anyway, and it's unreasonable to make options to list any particular part of it. Moreover, suggested -f syntax is not consistent with format filters.

@TheGr33k
Copy link
Author

@TheGr33k TheGr33k commented Mar 15, 2015

I am fine with any other syntax you guys may come up with but here i am
interested only with the urls

What regex can be used to extract the specific infos

On Sun, Mar 15, 2015 at 3:46 PM, Sergey M. notifications@github.com wrote:

All this info is extracted anyway, and it's unreasonable to make options
to list any particular part of it. Moreover, suggested -f syntax is not
consistent with format filters.


Reply to this email directly or view it on GitHub
#5209 (comment).

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 15, 2015

If you are using a shell script, then you just need to use jq:

$ youtube-dl test:youtube -f 137,136 -j | jq -r '"\(.format_id): \(.url)"'
137: https://r9---sn-h5q7ener.googlevideo.com/videoplayback?<...>
136: https://r9---sn-h5q7ener.googlevideo.com/videoplayback?<...>
@TheGr33k
Copy link
Author

@TheGr33k TheGr33k commented Mar 16, 2015

I am using php :)

On Sun, Mar 15, 2015 at 4:58 PM, Jaime Marquínez Ferrándiz <
notifications@github.com> wrote:

If you are using a shell script, then you just need to use jq
https://stedolan.github.io/jq/:

$ youtube-dl test:youtube -f 137,136 -j | jq -r '"(.format_id): (.url)"'
137: https://r9---sn-h5q7ener.googlevideo.com/videoplayback?<...>
136: https://r9---sn-h5q7ener.googlevideo.com/videoplayback?<...>


Reply to this email directly or view it on GitHub
#5209 (comment).

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 16, 2015

I don't use php, but it seems to have json support: http://php.net/manual/en/ref.json.php.
Just note that with my approach each line of the output will contain a single json object, so you need to decode each line individually.

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.