Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[YouTube] Combine Metube & SponsorBlock

I have been using MeTube for some time to occasionally download YouTube videos. Now I’ve been looking for a way to combine MeTube with SponsorBlock to get rid of the ads when downloading a file. And it turned out to be possible. You can either use SponsorBlock to add a chapter for an ad segment, or you can use it to remove the ad or any other segment using the remove_sponsor_segments parameter. Currently, it is not possible to do both things (create segment chapters + remove segments). Here the solution to remove ads while downloading:

Create the following JSON File:

{
  "postprocessors": [
    {
      "api": "https://sponsor.ajay.app/",
      "categories": [
        "intro",
        "outro",
        "poi_highlight",
        "selfpromo",
        "sponsor",
        "interaction" 
      ],
      "key": "SponsorBlock",
      "when": "after_filter"
    },
    {
      "force_keyframes": false,
      "key": "ModifyChapters",
      "remove_chapters_patterns": [],
      "remove_ranges": [],
      ""remove_sponsor_segments": ["sponsor","interaction","selfpromo"],
      "sponsorblock_chapter_title": "'[SponsorBlock]: ''%(category_names)l'"
    },
    {
      "add_chapters": true,
      "add_infojson": "none",
      "add_metadata": false,
      "key": "FFmpegMetadata"
    }
  ]
}

The relevant parts here are the categories:

  • intro — video intro segments
  • outro — video endings or credits
  • sponsor — sponsored ads/segments to skip
  • selfpromo — creator self-promotion clips
  • interaction — calls to action (like “subscribe” asks)
  • poi_highlight — important highlights or notable moments (Points of Interest)

And the remove_sponsor_segments parameter. Here you can provide all sections you want to have removed during a download.

The last step is to mount the JSON File into the Container:

version: '3'

services:
  metube:
    image: alexta69/metube
    ports:
      - "8081:8081"
    volumes:
      - ./downloads:/downloads
      - ./ytdl_options.json:/config/ytdl_options.json:ro # the first part must be the path/place of your new created json file
    environment:
      - YTDL_OPTIONS_FILE=/config/ytdl_options.json

To add video links to MeTube you can also use this handy Browser Add-on: MeTube Downloader

Leave a Reply

Your email address will not be published. Required fields are marked *