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

Chapter Skipping for SponSkrub Chapters in downloaded YT Videos #43

Open
Zefferis opened this issue Aug 28, 2021 · 2 comments
Open

Chapter Skipping for SponSkrub Chapters in downloaded YT Videos #43

Zefferis opened this issue Aug 28, 2021 · 2 comments

Comments

@Zefferis
Copy link

Summary Ask:

Skip SponSkrub - SponsorBlock Chapters in downloaded yt videos via Chapter Titles


The Command Line Application: yt-dlp allows users to easily/automatically use SponSkrub to create video Chapters based on the SponsorBlock API.

Because of this, downloaded videos can have chapters for: Sponsors, Introductions, Outros, Interactions, Self-Promos and Non-Music sections.

I haven't been able to get the lua script of chapterskip to automatically skip these Chapters, but I think it would be cool to integrate SponSkrub Chapter titles into the type of content that is skipped with the mpv_sponsorblock lua script.

Thanks :)

Type of chapters that could be skipped:
image

@po5
Copy link
Owner

po5 commented Sep 1, 2021

chapterskip definitely can skip those, but I can look into adding support in this script.
Could you send me list of chapter names that sponskrub generates for start & end times of various categories?

@jensecj
Copy link

jensecj commented Sep 14, 2021

The plugin already has all the parts needed for skipping sponsored sections, since it works fine when streaming files.

Both youtube-dl and yt-dlp adds the url of the source to the PURL field in the files metadata. (you can check it with mediainfo)

so around https://github.com/po5/mpv_sponsorblock/blob/master/sponsorblock.lua#L397, you could change it to something like

local purl = mp.get_property("metadata/by-key/PURL", "")

youtube_id = nil
for i,url in ipairs(urls) do
   youtube_id = youtube_id or string.match(video_path, url) or string.match(video_referer, url) or string.match(purl, url)
end

and it should work, does for me with downloaded files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants