/YTS-bot

A Python 3 script to watch for popular movies on YTS and send notifications in Slack

Primary LanguagePython

YTS Bot

This repository is archived in favor of go-yts

Docker Hub Docker image size GitHub issues

A Python 3 script to monitor for Popular Downloads on YTS and send notifications via Slack.

Script uses web scrapping methodology to check for popular downloads.

Dependencies

Scripts require following modules to function.

  1. requests
  2. bs4
  3. python-decouple

Execution

There are three ways to run this script.

  1. Run directly on host
  2. Run in a docker container
  3. Run using tasker

Run directly on host

Install all dependencies using following command.

python3 pip install -r requirements.txt

Rename file .env.example to .env (under src).

Populate enviroment variables memntioned in .env

Navigate to src and execute the script as follow.

python3 yts_bot.py

OR

Schedule the script execution using cron. Edit crontab file using command crontab -e and add following line at the end of the file.

0 */12 * * * python3 <path_to_src>/src/yts_bot.py

This runs the script every 12 hours.

Historical popular downloads are stored in file yts_movie_list.txt to avoid duplicate notifications. (Do not edit this file manually)

To periodically check for popular downloads, schedule the script using cron.

Run in docker container

Docker run

Pull the latest docker image from Docker Hub using following command.

docker pull hibare/yts_bot

Alternatively, you can build the docker image using following command.

docker build --rm -t yts_bot . --no-cache

Create following files.

  1. env
  2. history

Populate the first file (env) with following value.

SLACK_ENDPOINT=<your value here>

Run the container using following command.

docker run -d -v $PWD/.env:/app/.env -v $PWD/data:/data hibare/yts_bot:latest

Docker compose

version: "3.7"
services:
  yts_bot:
    image: hibare/yts_bot
    container_name: yts_bot
    hostname: yts_bot
    restart: always
    environment:
      - SLACK_ENDPOINT=<your value>
      - INTERVAL=12 #Optinal, default=12 hours
    volumes:
        - yts_data:/data
volumes:
  yts_data:

Update SLACK_ENDPOINT environment variable with Slack webhook URL.

❗ By default all cron jobs are scheduled to run every 12 hours.