An open API service indexing awesome lists of open source software.

https://github.com/aziascreations/youtube-auto-archiver

A simple python application that automatically checks if a Youtuber is streaming, and downloads said streams.
https://github.com/aziascreations/youtube-auto-archiver

archiving stream streamlink youtube youtube-live youtube-livestream

Last synced: 6 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Youtube Auto Archiver v0.7.2
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](https://owasp.org/www-community/attacks/Command_Injection)
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](https://lxml.de/)*" may fail to compile, but streamlink will work regardless since
it is installed via the "*[py3-lxml](https://pkgs.alpinelinux.org/packages?name=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
* [Python](https://www.python.org/) >= v3.9
* [Streamlink](https://streamlink.github.io/) >= v3.1.1, < v4.\*.\*
* [yt-dlp](https://github.com/yt-dlp/yt-dlp) >= v2022.02.04

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
```bash
git clone https://github.com/aziascreations/Youtube-Auto-Archiver.git
cd Youtube-Auto-Archiver
```

2. If desired, setup a Python virtual environment
```bash
pip install --upgrade virtualenv
python -m venv ./venv
```
* Linux:
```bash
source venv/bin/activate
```
* Windows:
```bash
venv\Scripts\activate
```

3. Install the required Python modules
```bash
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.

3. Configure the application's config file
4. Run the application

### Docker
1. Clone the repository and enter it
```bash
git clone https://github.com/aziascreations/Youtube-Auto-Archiver.git
cd Youtube-Auto-Archiver
```

2. Configure the [docker-compose.yml](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.

3. Build the container via *docker-compose*
```bash
docker-compose up --build
```

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

Please refer to [config.md](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](docker/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](https://github.com/abayochocoball/hollow_memories/blob/master/archiving_livestreams.md)
by [abayochocoball](https://github.com/abayochocoball)

    Helped greatly with downloading the thumbnail and description of a stream.

● The [yt-dlp](https://github.com/yt-dlp/yt-dlp) contributors

    For actually giving a fuck about maintaining and improving *youtube-dl*.

## License
[Unlicense](LICENSE)

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