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

[youtube] --dump-json "subtitles" key = null for video with subtitles #4602

Closed
Vdragon opened this issue Dec 31, 2014 · 4 comments
Closed

[youtube] --dump-json "subtitles" key = null for video with subtitles #4602

Vdragon opened this issue Dec 31, 2014 · 4 comments
Assignees
Labels

Comments

@Vdragon
Copy link

@Vdragon Vdragon commented Dec 31, 2014

I'm writing a program to parse youtube video supported format and subtitles, however the subtitles key of JSON output of youtube-dl --dump-json https://www.youtube.com/watch?v=iAy0tG56ZYg is null while youtube-dl --list-subs https://www.youtube.com/watch?v=iAy0tG56ZYg declares that the video has zh-TW,en,ja subtitles:

[youtube] iAy0tG56ZYg: Downloading webpage
[youtube] iAy0tG56ZYg: Extracting video information
[youtube] iAy0tG56ZYg: Looking for automatic captions
[youtube] iAy0tG56ZYg: Downloading XML
WARNING: Video doesn't have automatic captions
[youtube] iAy0tG56ZYg: Available subtitles for video: zh-TW,en,ja
[youtube] iAy0tG56ZYg: Available automatic captions for video:

I wonder that if it's youtube-dl's bug for not listing the available subtitles in subtitles key, or if it isn't, how should I parse a video's available subtitles?

Tested using 2014.12.16.2 version of youtube-dl

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 31, 2014

Subtitles info is not extracted unless you request it, you'll need to use --all-subs:

$ youtube-dl 'iAy0tG56ZYg' --all-subs --dump-json | jq '.subtitles | keys'
[
  "en",
  "ja",
  "zh-TW"
]
@jaimeMF jaimeMF closed this Dec 31, 2014
@Vdragon
Copy link
Author

@Vdragon Vdragon commented Jan 1, 2015

@jaimeMF
Thanks for replying, what I really need is a list of available subtitle languages(for a later youtube-dl call to actually download them, like --list-subs), however --all-subs includes entire subtitle content into the json which is far more than I expected.

Is there any better way to accomplish the same goal?

BTW: I've tried youtube-dl 'iAy0tG56ZYg' --list-formats --dump-single-json but it output null instead.

@phihag phihag reopened this Jan 2, 2015
@jaimeMF jaimeMF self-assigned this Feb 13, 2015
@jaimeMF jaimeMF added the subtitles label Feb 15, 2015
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 23, 2015

In the next version, youtube-dl 'iAy0tG56ZYg' --all-subs --dump-json will just return the subtitles urls and it won't download the contents with the --dump-json option (for reference: the changes are in PR #4964), therefore I'm closing the issue. Thanks for the report.

@jaimeMF jaimeMF closed this Feb 23, 2015
@phihag
Copy link
Contributor

@phihag phihag commented Feb 24, 2015

I believe this issue to be fixed in youtube-dl version 2015.02.24 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
3 participants
You can’t perform that action at this time.