YTRSS - subscription downloader

Program to automatic download any types of files from Internet.

https://img.shields.io/badge/author-Rafa%C5%82%20Kobel-blue.svg https://img.shields.io/readthedocs/ytrss.svg https://img.shields.io/github/last-commit/rafyco/ytrss.svg https://img.shields.io/github/issues/rafyco/ytrss.svg https://img.shields.io/pypi/v/ytrss.svg https://img.shields.io/github/license/rafyco/ytrss.svg

Description

YTRSS is a program that checks defined sources and downloads a movie or sound files from them and arrange them to podcast files. It can be highly configured with many plugins that add any other destinations.

The program in basic version use youtube_dl script to download files, so it cooperates with all services implements by this library. However user can extends this capabilities by his own custom plugins with external Downloaders.

Installation

The installation can be carried out in two ways. You can download packages from PyPi repository or install it from sources.

For installation from PyPi you can use pip program. It is likely that you must use pip3 instead pip.

pip install ytrss

You can also use source from github repository to install ytrss. To make that download code and invoke command:

python setup.py install

To checking the installation you can use to call ytrss. Unittest can be also helpful with verification.

Unit test

ytrss have a few unittest that you can use to checking code correctness. You can call it from setup.py file or using ytrss.tests module after installation. Check one of below command and try it yourself.

python setup.py test
python -m ytrss.tests

Other information

For more information about installation, configuration and bash completion read the documentation.

Author

Rafal Kobel rafalkobel@rafyco.pl

https://img.shields.io/static/v1.svg?label=Linkedin&message=Rafal%20Kobel&color=blue&logo=linkedin https://img.shields.io/static/v1.svg?label=Github&message=rafyco&color=blue&logo=github https://img.shields.io/static/v1.svg?label=Facebook&message=Rafal%20Kobel&color=blue&logo=facebook

Configuration

How to start

First of all you need to prepare config file, which helps you describe all the sources that you want to subscribe and destinations where movies should be downloaded. More information about

After that you need to share generated podcast on your private http server.

Remember that this library have no secure podcast file from other viewers. You public it on your own responsibility. Please make sure that author of your favorite movies allows you to make podcast from his files

Configuration file

The behaviour of the program you can define in configuration file. It tells what sources should be checked for new files and where will be saved or how to distribute them. The configuration file is a simple yaml (or json) file that named: config.yml (or config.json for json).

Localization

The ytrss looking for following directory to find this file and get first available to work with.

  1. From location defined in PYTHON_YTRSS_CONFIG environment.

  2. For windows from $HOME\\YTRSS file

  3. For linux in ~/.config/ytrss or /etc/ytrss/ file.

User also can set specific configuration file by define it with -c or --conf parameter in terminal client

Example configuration file

The configuration file has yaml format. The example of the file looks like this:

---
subscriptions:
  - name: Private playlist
    url: https://youtube.com/playlist?list=<playlist_id>
    destination: default
  - name: YouTube
    destination: youtube
    url: https://www.youtube.com/@YouTube
destinations:
  default:
    type: rss
    title: Youtube - podcast
    url_prefix: https://my.domain/ytdown/default
    author: youtube
    link: https://youtube.com
    desc: My favourite movies from YouTube
    img: https://www.youtube.com/yts/img/yt_1200-vfl4C3T0K.png
    path: /home/user/podcasts/default
  youtube:
    type: rss
    title: Youtube channel
    url_prefix: https://my.domain/ytdown/youtube
    author: youtube
    link: https://youtube.com
    desc: YouTube channel
    img: https://www.youtube.com/yts/img/yt_1200-vfl4C3T0K.png
    path: /home/user/podcasts/youtube

Main structure

Configuration keys

key

default value

description

subscriptions

required

-

List of sources that will be look for new files. See Subscriptions structure.

destinations

required

-

A list of elements where the files should be placed. See Destinations structure.

config_dir

optional

~/.config/ytrss for unix or ~\\YTRSS for windows

Directory where the configuration should be places

cache_path

optional

<config_dir>/cache

A place where all file should be downloaded before copy to destination

arguments

optional

[]

A list of parameters that are added to youtube_dl command

Subscriptions structure

Subscriptions structure

key

default value

description

name

optional

“<unknown>”

Readable name of source

url

required

-

A localization of source (e.x. url to youtube channel)

destination

optional

“default”

The destination where the file will be transfer. See Destinations structure.

enable

optional

True

If set to False the source won’t be used

Destinations structure

Destination structure

key

default value

description

type

required

-

Type of destination (e.x. rss for podcast)

title

optional

“unknown title”

Title of podcast

url_prefix

optional

(empty)

a string that have been added to podcast url

author

optional

“Nobody”

Author of podcast

link

optional

http://youtube.com

List to podcast (e.x. to youtube channel)

desc

optional

“No description”

Description of podcast

img

optional

None

Optional url to podcast image

path

required

-

Path that the file should be saved

Terminal client

The client module is the main tool for communicating with the library. It allows interaction with various functions and operations available in the library.

To search and download all the movies and generate podcast according the configuration use run command

ytrss run

More information about available commands you can search using –help argument.

$ ytrss --help
usage: ytrss [-h] [-c FILE] [-d]
             {help,version,run,generate,configuration,download,url} ...

command line tool to manage ytrss package

optional arguments:
  -h, --help            show this help message and exit
  -c FILE, --conf FILE  configuration file
  -d, --debug-log       Enable debug logging

commands:
  Use once of this commands

  {help,version,run,generate,configuration,download,url}
    help                Print help message
    version             Show version of this program
    run                 Find movie from sources and download
    generate            Generate elements in destinations.
    configuration       Print configuration
    generate            Generate elements in destinations.
    download            Immediately download a movie to current location.
    url                 Add url to download

Before using the client, ensure that the configuration is set appropriately to customize the client’s behavior according to your preferences.

Plugins

Todo

Configuration’s documentation

import abc
from typing import Iterable, Tuple

from ytrss.configuration.entity.destination_info import DestinationId
from ytrss.core.entity.movie import Movie


class SourceDownloaderError(Exception):
    """ This is source downloader error """


class SourceDownloader(metaclass=abc.ABCMeta):
    """ Source downloader abstract class.

    This class represents a source of movies. It should check a source and returns an iterable
    list of movies available to download.
    """

    @property
    @abc.abstractmethod
    def movies(self) -> Iterable[Tuple[Movie, DestinationId]]:
        """ A list of movies available to download with destination id of this movie"""
class ytrss.core.entity.source_downloader.SourceDownloader

Source downloader abstract class.

This class represents a source of movies. It should check a source and returns an iterable list of movies available to download.

abstract property movies: Iterable[Tuple[Movie, DestinationId]]

A list of movies available to download with destination id of this movie

exception ytrss.core.entity.source_downloader.SourceDownloaderError

This is source downloader error

Todo

Configuration’s documentation #40

Todo

Configuration’s documentation #40

Changelog

0.3

0.3.0

Warning

This version has different configuration file format and terminal client. You can’t use configuration from previous version. Please read documentation and update it.

  • fix small bugs

  • new format of configuration (see: configuration)

  • new terminal tool (see: terminal)

  • support for all services from youtube_dl

  • locally download url

  • add url from console

  • auto made new configuration

0.2

0.2.8

  • fix small bugs

0.2.6

  • Repair config files

  • Documentation in sphinx

0.2.5

  • fix small bugs

0.2.4

  • fix small bugs

0.2.3

  • fix small bugs

0.2.2

  • fix small bugs

0.2.1

  • Delete older files

0.2.0

  • Files download to specific directory

  • Read data of downloaded movie

  • Generate RSS channel for downloaded movie

0.1

0.1.6

  • fix small bugs

0.1.5

  • Daemon for linux

0.1.4

  • Support for python3

  • Reduce commands to one prog

0.1.3

  • First working version.

  • Unit test.

0.1.2

  • fix small bugs

0.1.1

  • fix small bugs

0.1.0

  • fix small bugs

0.0

0.0.5

  • fix small bugs

0.0.4

  • fix small bugs

0.0.3

  • fix small bugs

0.0.2

  • fix small bugs

0.0.1

  • fix small bugs