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

Get link option (-g) returns multiple URLs if no format is given #10707

Closed
affinityv opened this issue Sep 20, 2016 · 7 comments
Closed

Get link option (-g) returns multiple URLs if no format is given #10707

affinityv opened this issue Sep 20, 2016 · 7 comments
Labels

Comments

@affinityv
Copy link

@affinityv affinityv commented Sep 20, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.09.19. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.09.19

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ youtube-dl -v --proxy 127.0.0.1:8118 -g ogs_g9BlGQc
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'--proxy', u'127.0.0.1:8118', u'-g', u'ogs_g9BlGQc']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.09.19
[debug] Python version 2.7.12 - Linux-4.4.0-36-generic-x86_64-with-LinuxMint-18-sarah
[debug] exe versions: avconv 2.8.6-1ubuntu2, avprobe 2.8.6-1ubuntu2, ffmpeg 2.8.6-1ubuntu2, ffprobe 2.8.6-1ubuntu2
[debug] Proxy map: {u'http': u'127.0.0.1:8118', u'https': u'127.0.0.1:8118'}
https://r6---sn-5hne6nee.googlevideo.com/videoplayback?id=a20b3f83d0651907&itag=137&source=youtube&requiressl=yes&initcwndbps=4606250&mn=sn-5hne6nee&mm=31&ms=au&mv=m&nh=IgpwcjA0LmFtczE1KgkxMjcuMC4wLjE&pl=24&ratebypass=yes&mime=video/mp4&gir=yes&clen=279023&lmt=1474124975384925&dur=13.066&signature=962C60A1D50F379A1DCB658FE09D5E082F94A354.197BC8E04DC461826ADCC3C8A57F1241A5BCEAB6&upn=poRTbVS6CK0&key=dg_yt0&mt=1474334512&ip=77.247.181.165&ipbits=0&expire=1474356654&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mn,mm,ms,mv,nh,pl,ratebypass,mime,gir,clen,lmt,dur
https://r6---sn-5hne6nee.googlevideo.com/videoplayback?id=a20b3f83d0651907&itag=140&source=youtube&requiressl=yes&initcwndbps=4606250&mn=sn-5hne6nee&mm=31&ms=au&mv=m&nh=IgpwcjA0LmFtczE1KgkxMjcuMC4wLjE&pl=24&ratebypass=yes&mime=audio/mp4&gir=yes&clen=209496&lmt=1474124971169489&dur=13.119&signature=64B71EF4DCEF251C752FA43E519413A3BF2AA4A9.343981F4E15E16A2B065051C38B3FFE540FD37DF&upn=poRTbVS6CK0&key=dg_yt0&mt=1474334512&ip=77.247.181.165&ipbits=0&expire=1474356654&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mn,mm,ms,mv,nh,pl,ratebypass,mime,gir,clen,lmt,dur


...
<end of log>

Description of your issue, suggested solution and other information

This issue is mitigated by passing "-f best" to the command line options, then you only get one URL as expected.

So, this works:
$ youtube-dl -v -f best --proxy 127.0.0.1:8118 -g ogs_g9BlGQc
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'-f', u'best', u'--proxy', u'127.0.0.1:8118', u'-g', u'ogs_g9BlGQc']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.09.19
[debug] Python version 2.7.12 - Linux-4.4.0-36-generic-x86_64-with-LinuxMint-18-sarah
[debug] exe versions: avconv 2.8.6-1ubuntu2, avprobe 2.8.6-1ubuntu2, ffmpeg 2.8.6-1ubuntu2, ffprobe 2.8.6-1ubuntu2
[debug] Proxy map: {u'http': u'127.0.0.1:8118', u'https': u'127.0.0.1:8118'}
https://r9---sn-5hnedned.googlevideo.com/videoplayback?expire=1474356685&mime=video%2Fmp4&key=yt6&ipbits=0&lmt=1474125002343928&itag=22&mt=1474334831&mv=m&ms=au&signature=C163FB6712FAFFA6115401FA8171AB3999E38400.0A917C58A8F1A07A2D2119C724FB0F7FE5715516&mm=31&mn=sn-5hnedned&upn=zNXP_mI09YE&id=a20b3f83d0651907&ip=77.247.181.165&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ei=bZHgV5_6JsXNctn8iegD&dur=13.119&initcwndbps=4665000&pl=24&ratebypass=yes&source=youtube&requiressl=yes&nh=IgpwcjA0LmFtczE2KgkxMjcuMC4wLjE

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 20, 2016

This is expected behavior.

@dstftw dstftw closed this Sep 20, 2016
@dstftw dstftw added the invalid label Sep 20, 2016
@affinityv
Copy link
Author

@affinityv affinityv commented Sep 20, 2016

-g, --get-url                    Simulate, quiet but print URL

"URL is singular.. "

Enhancement?
-ga -- for audio component URL
-gv -- for video component URL
or
-g just for one URL for the target.

What I really want is the published date of the video; you can /sort of/ get that by continuing to follow from the provided URL [2] until you get one doesn't have a "Location:" header. The final URL has "Last-Modified:" and "Content-Length: " headers, both of which are useful. However, the "Last-Modified:" header doesn't actually give the publish date if the file has been updated for any reason.

Is it possible to get the actual full timestamp (date and time) for the publish date? EPOCH seconds is fine.

[2] Having multiple URLs threw off my code.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 20, 2016

  1. Use -f. For example -f bestvideo -g results in a single video URL.
  2. Use -j and parse the resultant JSON. What you need is in upload_date and timestamp.
@affinityv
Copy link
Author

@affinityv affinityv commented Sep 20, 2016

Okay, the JSON doesn't have timestamp, it does have upload_date.

And 'best' -- is that enough? It might be audio only.....?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 20, 2016

bestaudio, if you want the audio. You can also use a specific format ID.

@affinityv
Copy link
Author

@affinityv affinityv commented Sep 20, 2016

best on it's own did return a single url as expected.

The code I am working on will download audio or video based on the provided ID, unless I specifically choose the format; although yt IDs are all videos, even if the image is static (I think).

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 20, 2016

although yt IDs are all videos, even if the image is static

Yes that's the case.

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.