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] video not getting video "chapters" properly #24819

Closed
anabis opened this issue Apr 16, 2020 · 8 comments
Closed

[youtube] video not getting video "chapters" properly #24819

anabis opened this issue Apr 16, 2020 · 8 comments

Comments

@anabis
Copy link

@anabis anabis commented Apr 16, 2020

The 'chapters' value from the JSON (-J parameter), is usually present on some video. But since a few days, it is not available in ANY video. My guess is that's since the new chapter UI of youtube.

Here's a verbose excerpt from youtube version 23.04.2020, not that it looks very useful

[ ~ ] $ youtube-dl -vJ https://www.youtube.com/watch?v=gBRKnvK1JUE 
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-vJ', u'https://www.youtube.com/watch?v=gBRKnvK1JUE']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.24
[debug] Python version 2.7.16 (CPython) - Linux-4.19.0-8-amd64-x86_64-with-debian-10.3
[debug] exe versions: ffmpeg 4.1.5, ffprobe 4.1.5
[debug] Proxy map: {}
[debug] Default format spec: bestvideo+bestaudio/best
{"upload_date": "20190921", "extractor": "youtube", "chapters": null, ...
@VolatileCable
Copy link

@VolatileCable VolatileCable commented Jul 14, 2020

This seems to have broken again in 2020.06.16.1 .

The JSON chapter tag is just null with both the mentioned https://www.youtube.com/watch?v=gBRKnvK1JUE and also https://www.youtube.com/watch?v=Vr93xAFmJag . They also have different formats in the description.

I found this while investigating if youtube-dl writes these chapters to mkv files. This is not the case, even if this were working in the first place, right?

@VolatileCable
Copy link

@VolatileCable VolatileCable commented Jul 14, 2020

Actually, I think this is all caused by #25937 .

@someziggyman
Copy link

@someziggyman someziggyman commented Jul 31, 2020

Chapters are still NULL in 2020.07.28 release

@DrAutissimo
Copy link

@DrAutissimo DrAutissimo commented Sep 5, 2020

Doesn't work on current master branch, #26297 fixes this.

@sheerluck
Copy link

@sheerluck sheerluck commented Sep 19, 2020

#26297 fixes this.

#26297 fixes this for https://youtu.be/7LFJ7zSFUa8 and https://youtu.be/fzK79PgKITI
I wonder maybe youtube-dl could split video into chapters? (sudden feature request: to add --split-into-chapters so several files would be generated)

@DrAutissimo
Copy link

@DrAutissimo DrAutissimo commented Sep 20, 2020

I think that request was already made a couple of times, don't remember what was said about it though.
There are a lot of splits that do exactly that though:
wattux/youtube-dl@dcab738

If something breaks, you can just copy the new part of the postprocessor, and put it into a new version of ytdl.
You might need to do some tweaking though, since some youtube videos have filenames that windows normally wouldn't allow.

@sheerluck
Copy link

@sheerluck sheerluck commented Sep 21, 2020

Thank you very very much!
Works like a charm!
https://i.imgur.com/DAiXKg6.png
My filenames tweaking is

--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2091,6 +2091,12 @@ def sanitize_filename(s, restricted=False, is_id=False):
             return '' if restricted else '\''
         elif char == ':':
             return '_-' if restricted else ' -'
+        elif char == '|':
+            return chr(65372)
+        elif char == '/':
+            return chr(10744)
+        elif char == '\\':
+            return chr(10745)
         elif char in '\\/|*<>':
             return '_'
         if restricted and (char in '!&\'()[]{}$;`^,#' or char.isspace()):
@DrAutissimo
Copy link

@DrAutissimo DrAutissimo commented Sep 21, 2020

That's a way more elegant solution than mine, I just changed the def _build_track_name to replace characters with a space.

But glad to have helped, still would be real nice to see this functionality implemented into YTDL one day :^)

Only problem that I had so far is that it apparently creates a second track per file with length 0, and if you open a split file in f.e. F2K, it shows two tracks, but one is immediately skipped over, nothing unusable, just annoying.

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