Git Product home page Git Product logo

sonarr_yt-dlp's Introduction

Replace youtubedl with latest yt-dlp and use python:alpine to create smaller image.

bdwinanto/sonarr_yt-dlp is a Sonarr companion script to allow the automatic downloading of web series normally not available for Sonarr to search for. Using yt-dlp it allows you to download your webseries from the list of supported sites.

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 and it can then update your plex as and 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 its an openly editable site sometime there can be differences.

Supported Architectures

The architectures supported by this image are:

Architecture Tag
arm64 latest
armhf latest
amd64 latest

Version Tags

Tag Description
latest Current release code
{yt-dlp release version} Pre-release code for testing issues

Great how do I get started

Obviously its 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 \
  -v /path/to/data:/config \
  -v /path/to/sonarrmedia:/sonarr_root \
  -v /path/to/logs:/logs \
  --restart unless-stopped \
  bdwinanto/sonarr_yt-dlp:latest

docker-compose

---
version: '3.4'
services:
  sonarr_yt-dlp:
    image: bdwinanto/sonarr_yt-dlp:latest
    container_name: sonarr_yt-dlp
    volumes:
      - /path/to/data:/config
      - /path/to/sonarrmedia:/sonarr_root
      - /path/to/logs:/logs

Docker volumes

Parameter Function
-v /config sonarr_yt-dlp configs
-v /sonarr_root Root library location from Sonarr container
-v /logs log 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.

Note

If you find yt-dlp able to download series but this docker is not able to, probably yt-dlp need to be updated to latest version. Please check yt-dlp=={version} in requirements.txt and update accordingly.

If I helped in anyway and you would like to help me, consider donating a lovely beverage with the below.

Buy Me A Coffee

sonarr_yt-dlp's People

Contributors

whatdaybob avatar bdwinanto avatar bm1549 avatar chipwolf avatar

Stargazers

Deanosim avatar Adam Brown avatar

Watchers

 avatar

Forkers

brymck1

sonarr_yt-dlp's Issues

www.dropout.tv unsupported

Config:

sonarrytdl:
    scan_interval: 1
    debug: True
sonarr:
    host: sonarr
    port: 8989
    apikey: **********
    ssl: false
ytdl:
    default_format: bestvideo+bestaudio/best
series:
  - title: Dimension 20
    url: https://www.dropout.tv/dimension-20
    subtitles:
      languages: ['en.*']
    cookies_file: cookies.txt

Attempting to download a series from dropout.tv (which is supported by yt-dlp) causes the following error:

2022-01-16 14:00:34,891 - sonarr_youtubedl - INFO -   Dimension 20:
2022-01-16 14:00:34,892 - sonarr_youtubedl - DEBUG -   Cookies file used: /config/cookies.txt
2022-01-16 14:00:34,893 - sonarr_youtubedl - DEBUG - Youtube-DL opts used for episode matching
2022-01-16 14:00:34,894 - sonarr_youtubedl - DEBUG - {'ignoreerrors': True, 'playlistreverse': True, 'matchtitle': 'THE\\ BEGINNING\\ BEGINS', 'quiet': False, 'logger': <utils.YoutubeDLLogger object at 0x7fac6f417cd0>, 'progress_hooks': [<function ytdl_hooks at 0x7fac6f43f130>], 'cookie': '/config/cookies.txt'}
2022-01-16 14:00:35,664 - sonarr_youtubedl - DEBUG - [generic] dimension-20: Requesting header
2022-01-16 14:00:36,379 - sonarr_youtubedl - INFO - [generic] Falling back on generic information extractor.
2022-01-16 14:00:36,381 - sonarr_youtubedl - DEBUG - [generic] dimension-20: Downloading webpage
2022-01-16 14:00:37,002 - sonarr_youtubedl - DEBUG - [generic] dimension-20: Extracting information
2022-01-16 14:00:37,267 - sonarr_youtubedl - ERROR - ERROR: Unsupported URL: https://www.dropout.tv/dimension-20
Traceback (most recent call last):
  File "/app/sonarr_youtubedl.py", line 421, in <module>
    main()
  File "/app/sonarr_youtubedl.py", line 415, in main
    client.download(series, episodes)
  File "/app/sonarr_youtubedl.py", line 343, in download
    found, dlurl = self.ytsearch(ydleps, url)
  File "/app/sonarr_youtubedl.py", line 316, in ytsearch
    if 'entries' in result and len(result['entries']) > 0:
TypeError: argument of type 'NoneType' is not iterable

The call to yt-dlp directly produces expected results:

~ -> yt-dlp https://www.dropout.tv/dimension-20 --username ***** --password *****
[DropoutSeason] dimension-20: Downloading webpage
[download] Downloading playlist: Dimension 20 - Fantasy High
[DropoutSeason] playlist Dimension 20 - Fantasy High: Collected 20 videos; downloading 20 of them
[download] Downloading video 1 of 20
[Dropout] episode-1: Getting authenticity token
[Dropout] episode-1: Logging in
[Dropout] episode-1: Downloading video webpage
[Dropout] episode-1: Logging out
[vhx:embed] 320562: Downloading webpage
[vhx:embed] 320562: Downloading JSON metadata
[vhx:embed] 320562: Downloading akfire_interconnect_quic m3u8 information
WARNING: [vhx:embed] Ignoring subtitle tracks found in the HLS manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; see  https://github.com/yt-dlp/yt-dlp  on how to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.
[vhx:embed] 320562: Downloading akfire_interconnect_quic m3u8 information
[vhx:embed] 320562: Downloading fastly_skyfire m3u8 information
[vhx:embed] 320562: Downloading fastly_skyfire m3u8 information
[vhx:embed] 320562: Downloading akfire_interconnect_quic MPD information
[vhx:embed] 320562: Downloading akfire_interconnect_quic MPD information
[vhx:embed] 320562: Downloading fastly_skyfire MPD information
[vhx:embed] 320562: Downloading fastly_skyfire MPD information
[info] 320562: Downloading 1 format(s): hls-fastly_skyfire-4707
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1139
[download] Destination: The Beginning Begins [320562].mp4
[download]   0.3% of ~3.82GiB at  4.31MiB/s ETA 07:19 (frag 3/1139)

Is this really the best solution for regexing?

I'm trying to download from https://roosterteeth.com/series/rwby but in Sonarr the episode names are like this The Shining Beacon (1) The Shining Beacon (2) and on the site it's The Shining Beacon The Shining Beacon, Pt.2
the best solution I could come up with is

    regex:
      sonarr:
        match: '[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* \(1\)'
        replace: 'The Shining Beacon'
        match: '[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* \(2\)'
        replace: 'The Shining Beacon, Pt.2'
        match: '[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* \(1\)'
        replace: 'The First Step'
        match: '[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* \(2\)'
        replace: 'The First Step, Pt.2'

But it seems like a pain, have to enter the episode name for every episode, tried entering regex in the replace Field and it just printed the regex
image

Downloading files to incorrect location?

My docker-compose.yml file looks like this:

  sonarr_yt-dlp:
    image: bdwinanto/sonarr_yt-dlp:latest
    container_name: sonarr_yt-dlp
    volumes:
      - /mnt/data/appdata/sonarr_yt-dlp:/config
      - /mnt/data/media/tvshows:/sonarr_root
      - /mnt/data/appdata/sonarr_yt-dlp/logs:/logs

Here is my config.yml:

sonarrytdl:
    scan_interval: 1
    debug: true
sonarr:
    host: 192.168.1.226
    port: 8989
    apikey: [REDACTED]
    ssl: false
ytdl:
    default_format: bestvideo[height<=1080]+bestaudio/best[height<=1080]
series:
  - title: Defunctland
    url: https://www.youtube.com/c/Defunctland/

However, in the sonarr_youtubedl.log I show lots of the following:

sonarr_youtubedl - DEBUG - {'format': 'bestvideo[height<=1080]+bestaudio/best[height<=1080]', 'quiet': False, 'merge-output-format': 'mp4', 'outtmpl': '/sonarr_root/data/media/tvshows/Defunctland/Season 1/Defunctland - S1E25 - Unused and New Footage of Extinct Attractions WEBDL.%(ext)s', 'progress_hooks': [<function ytdl_hooks_debug at 0x7f36018f2830>], 'noplaylist': True, 'logger': <utils.YoutubeDLLogger object at 0x7f360130d330>}

Note how it's saving to /sonarr_root/data/media/tvshows/ rather than just /sonarr_root/? It's appending one onto the other.

Am I doing something dumb, or is this a bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.