Skip to content

A simple python application that automatically checks if a Youtuber is streaming, and downloads said streams.

License

Notifications You must be signed in to change notification settings

aziascreations/Youtube-Auto-Archiver

Repository files navigation

Youtube Auto Archiver v0.7.1

A simple and yet highly configurable Python application that automatically checks if a Youtuber is streaming, and downloads said streams while also archiving its latest uploads.

The application will be improved as I have time to do so, or if you raise an issue when I have time to look into it.

Warning

Due to the way some commands are executed, it is possible to have a command injection vulnerability if you mess up or leave the config file editable by everyone.
This might be fixed in the future, but don't count on it as this project is a personal one.

The Python module named "lxml" may fail to compile, but streamlink will work regardless since it is installed via the "py3-lxml" package.

The application isn't designed to be used by another one as a module.

Features

  • General
    • Can run on Windows and Linux (Tested on x64 and ARMv8)
    • Relatively high level of configurability.
  • YouTube
    • Automatic livestream download through https://youtube.com/c/.../live
    • Automatic livestream thumbnail and description download.
    • Automatic download of uploads and their metadata.
    • Configurable delays, actions, locations per channel.
  • Planned for v1.0.0
    • Native support for cookies for yt-dlp and maybe streamlink.
    • Better support to prevent command injection. (Will block some features if used)
  • Planned for later
    • Using TOML for the config file when Python 3.11 is released and stable.

Requirements

The application may work just fine with older or newer versions of these pieces of software, but they will not be supported.
All requirements, except for Python, can be installed via pip or manually.

Installation

Standalone

  1. Clone the repository and enter it
git clone https://github.com/aziascreations/Youtube-Auto-Archiver.git
cd Youtube-Auto-Archiver
  1. If desired, setup a Python virtual environment
pip install --upgrade virtualenv
python -m venv ./venv
  • Linux:
source venv/bin/activate
  • Windows:
venv\Scripts\activate
  1. Install the required Python modules
pip install -r requirements.txt

Please note that streamlink may need to be compiled when installed via pip.
You can ignore it as long as the executable is accessible in the PATH environment variable.

  1. Configure the application's config file
  2. Run the application

Docker

  1. Clone the repository and enter it
git clone https://github.com/aziascreations/Youtube-Auto-Archiver.git
cd Youtube-Auto-Archiver
  1. Configure the docker-compose.yml file.

If you are running Docker on Windows, or on a NTFS mount under Linux, you may need to run the application as root since the output volume binding's permissions can't be properly configured.

  1. Build the container via docker-compose
docker-compose up --build

Config

The config is stored in config.json and has to be in the same folder as app.py, unless the appropriate environment variables tells the application to look elsewhere for it.

Please refer to config.md for more information on the config file and its fields.

Regarding the configuration of this container, all you have to do is change the /data volume if you need it in a specific location.

Build Arguments (Docker)

Variable Type Remark Default
BUID Integer User ID under which the app runs and who owns the app's directory.
May not work on Windows and NTFS volumes !
1000
BGID Integer Group ID under which the app runs and who owns the app's directory.
May not work on Windows and NTFS volumes !
1000

Environment Variables

Any environment variable that is not set will have the effect of its default value.

Please note that the docker-compose.yml files already has its environment variables set, as well as an independent config file setup.

Variable Type Remark Default
YAA_ALLOW_ROOT Boolean (0|1) Can be used to prevent the application from running as root on Linux-based systems. (UID==0) 1
YAA_CONFIG_PATH String Indicates where the config file can be found.
The path can be relative to app.py's location, or absolute.
"./config.json"

Credits

Livestream achival guide by abayochocoball
    Helped greatly with downloading the thumbnail and description of a stream.

● The yt-dlp contributors
    For actually giving a fuck about maintaining and improving youtube-dl.

License

Unlicense

This license does not apply to the required Python modules or any other required piece of software.