Sign inSign up

willjbrown/sonarr_yt-dlp

By willjbrown

•Updated over 3 years ago

Automatically download webseries to Sonarr using yt-dlp

Image
0

1.5K

willjbrown/sonarr_yt-dlp repository overview

⁠sonarr_yt-dlp

Forked from Sonarr_youtubedl by @whatdaybob⁠

Docker Build Docker Pulls Docker Stars Docker Hub

whatdaybob/sonarr_youtubedl⁠ is a Sonarr⁠ companion script to allow the automatic downloading of web series normally not available for Sonarr to search for. Using YT-DLP⁠ (a youtube-dl fork with added features) it allows you to download your webseries from the list of supported sites⁠.

This is my fork of that project.

⁠Features

  • Downloading Web Series using online sources normally unavailable to Sonarr
  • Ability to specify the downloaded video format globally or per series
  • Downloads new episodes automatically once available
  • Imports directly to Sonarr, which can then update your Plex server, as an example
  • Allows setting time offsets to handle prerelease series
  • Can pass cookies.txt to handle site logins

⁠How do I use it

Firstly you need a series that is available online in the supported sites that YouTube-DL can grab from.

Secondly you need to add this to Sonarr and monitor the episodes that you want.

Thirdly edit your config.yml accordingly so that this knows where your Sonarr is, which series you are after and where to grab it from.

Lastly be aware that this requires the TVDB to match exactly what the episodes titles are in the scan, generally this is ok but as it's an openly editable site sometime there can be differences. You can use regexes⁠ to bridge the gap between Sonarr and YouTube.

⁠Supported Architectures

The architectures supported by this image are:

ArchitectureTag
x86-64latest
x86-64dev

⁠Version Tags

TagDescription
latestCurrent release code
devPre-release code for testing issues

⁠Great how do I get started

Obviously it's a docker image, so you need docker. If you don't know what that is you need to look into that first.

⁠docker
docker create \
  --name=sonarr_yt-dlp \
  -e PUID=1000 \
  -e PGID=1000 \
  -v /path/to/data:/config \
  -v /path/to/sonarrmedia:/sonarr_root \
  -v /path/to/logs:/logs \
  --restart unless-stopped \
  willjbrown/sonarr_yt-dlp:latest
⁠docker-compose
---
version: '3.4'
services:
  sonarr_youtubedl:
    image: willjbrown/sonarr_yt-dlp:latest
    container_name: sonarr_yt-dlp
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /path/to/data:/config
      - /path/to/sonarrmedia:/sonarr_root
      - /path/to/logs:/logs
⁠Docker volumes
ParameterFunction
-v /configsonarr_youtubedl configs
-v /sonarr_rootRoot library location from Sonarr container
-v /logslog location

Clarification on sonarr_root

A couple of people are not sure what is meant by the sonarr root. As this downloads directly to where you media is stored I mean the root folder where sonarr will place the files. So in sonarr you have your files moving to /mnt/sda1/media/tv/Smarter Every Day/ as an example, in sonarr you will see that it saves this series to /tv/Smarter Every Day/ meaning the sonarr root is /mnt/sda1/media/ as this is the root folder sonarr is working from.

⁠Configuration file

On first run the docker will create a template file in the config folder. Example config.yml.template⁠

Copy the config.yml.template to a new file called config.yml and edit accordingly.

⁠Episode offset

Some series can be released on one platform and then released a week later as an example. Patreon is an example of this, so the release date will be before the youtube release. You can add an offset to push this a week later.

  - title: A patreon series that releases a week later on youtube
    url: https://www.youtube.com/playlist?list=ABC123DEF456GHI789J0
    offset:
      weeks: 1 
      days: 2
      hours: 12
      minutes: 0
⁠Ignore Date range

To help narrow down results and get what you want, sonarr_youtubedl will automatically add a date range to the search parameters. This is one day either side of the airdate in Sonarr. This can cause issues if you are downloading some videos that have been reuploaded or modified. To stop the search doing this you will need to add ignore_daterange: True to the series you want to ignore this feature. An example is below.

  - title: Ready Set Show
    url: https://www.youtube.com/playlist?list=PLTur7oukosPEwFTPJ1WeDvitauWzRiIhp
    playlistreverse: False
    ignore_daterange: True
    subtitles: 
      languages: ['en']
      autogenerated: True
⁠Episode title regex support

When the episode titles in Sonarr and YouTube differ, you can specify regexes that will rewrite the Sonarr episode title to match those found on YouTube. The configuration per series is as follows:

series:
  - title: Example
    url: https://www.youtube.com/playlist?list=example
    regex:
      sonarr:
        - match: 'France'
          replace: '(ep#1)'
        - match: 'America'
          replace: '(ep#2)'
        - match: 'Mexico/India'
          replace: '(ep#3)'

Each regex will be executed in sequence. The Sonarr episode title is the input for the first regex, and the output of each regex is used as the input for the next in the list.

Enabling debugging can help with understanding how the regex is changing the titles. An example debug log shows this below.

2022-04-13 22:47:23,576 - sonarr_youtubedl - DEBUG - Updating episode title "Who Smuggled a Comedians DOG? - #27" with regex ".-.#[0-9]*$" and replacement ""
2022-04-13 22:47:23,583 - sonarr_youtubedl - DEBUG - New title "Who Smuggled a Comedians DOG?"

Using a site like Regex101⁠ can help build regular expressions and help understand how they work if your not too familiar with them.

⁠Thanks and feedback / collaboration is always welcome!

Consider donating a beverage to the original author with the below.

Buy Me A Coffee

Tag summary

Content type

Image

Digest

sha256:b7b688b02…

Size

452.3 MB

Last updated

over 3 years ago

docker pull willjbrown/sonarr_yt-dlp