CoolFool / Ravager

A telegram bot that downloads content in the form of torrent and direct download links and mirrors them 1:1 to google drive
MIT License
40 stars 54 forks source link
aria2 bot celery docker docker-compose downloader google-drive-uploader heroku mirror-bot self-hosted telegram torrent-downloader
ravager logo

A telegram bot that downloads content in the form of torrent and direct download links and mirrors them 1:1 to google drive

Contents

Introduction

This is a telegram bot which supports torrent file,magnet uri as well as direct download links,it uses aria2 as a backend for downloading the content and uploads it to google drive. It can be deployed to heroku free dyno or on a server.

Features

Environment Variables

To run this project, you will need to set the following environment variables :

Core Environment Variables
    APP_URL

    The url where the app will be hosted i.e for heroku it will be https://{appname}.herokuapp.com or for self-hosted server it will be https://{hostname_or_ip}:{port} where port is usally 8443

    CLIENT_CONFIG

      To create a Google Cloud project:

      1. Open the Google Cloud Console.
      2. At the top-left, click Menu > IAM & Admin > Create a Project.
      3. In the Project Name field, enter a descriptive name for your project.
        Optional: To edit the Project ID, click Edit. The project ID can't be changed after the project is created, so choose an ID that meets your needs for the lifetime of the project.
        In the Location field, click Browse to display potential locations for your project. Then, click Select
      4. Click Create. The console navigates to the Dashboard page and your project is created within a few minutes.

      Configure the Project:

      1. Open the Google Cloud Console Dashboard and select your project
      2. At the top-left, click Menu > APIs & Services
      3. On the left side menu,Select Library/
      4. Search for Google Drive in the search bar the API library and Select and Enable Google Drive API
      5. Again at the top-left, click Menu > APIs & Services
      6. On the left side menu,Select Credentials, select Create credentials, then OAuth client ID.
      7. You may be prompted to set a product name on the Consent screen; if so, click Configure consent screen, supply the requested information following the notes below, and click Save to return to the Credentials screen
      8. OAuth consent screen Configuration:

        1. Select user type as external
        2. Fill the required details
        3. In the scopes page,Click on Add or Remove Scopes
        4. Search and Add /auth/drive and /auth/drive.metadata scopes and click on update
        5. You should see the scopes added in Your Sensitive Scopes Section
        6. Click on Save and Continue for rest of the sections
        7. On the OAuth consent screen Click on Publish App and Confirm
        8. Ignore Needs verification warning for the time being,the users will only see the warning while authorizing but please note there's a limit to number of users for unverified apps
      9. Again On the left side menu,select Credentials and then select Create credentials, then OAuth client ID
      10. Select Web Application for the Application Type. Follow the instructions to enter JavaScript origins, redirect URIs, or both.
        1. In Javascript Origins add your domain name which should be APP_URL
        2. In Authorized redirect URIs Add your redirect uri which should be APP_URL/oauth_handler
      11. Click Create.
      12. Download your client_secret.json from the popup modal or from under OAuth 2.0 Client IDs
      13. Open client_secret.json and copy the whole config as CLIENT_CONFIG
    BOT_TOKEN

    The bot token for telegram bot, for more info on how to create a bot and get a token visit How to create a telegram bot

    STATE_SECRET_KEY

    A random alphanumeric text used as a salt in generating state for oauth authorization.
    Not required in heroku caused generator is used while deploying

    BOT_URL

    The telegram bot url,this is usually in the form https://t.me/{bot_username}

    ALLOWLIST

    Should there be a filter where password is required for access to the bot
    Set as "True" or "False"

    GROUP_PASSWORD

    Password used for allowing a group chat access to the bot,should be set if "ALLOWLIST" is enabled

    USER_PASSWORD

    Password used for allowing a user access to the bot,should be set if "ALLOWLIST" is enabled

Environment Variables for Heroku only
    KEEP_HEROKU_ALIVE

    The application hosted in heroku free dyno sleeps after 20 minutes of no activity,to conteract this the application can ping itself every 5 minutes and keep itself alive.
    Should be set to either "True" or "False"

    HEROKU_API_TOKEN

    Heroku dynos are restarted every 24 hours + random(0-216)minutes,but if there is a restart before that the restart time is reset. The bot can give you the approx restart time and restart itself when no activity occurs for 4 hours if it has the Platform API Token
    The token can be found here

Optional Environment Variables
    DATABASE_URL

    The DATABASE URI for custom SQL Database

    REDIS_URL

    The URL for connecting to custom redis instance

    LOG_LEVEL

    The log level to be displayed in console,all the log levels can be found here
    Only numeric value is supported

    PORT

    Custom port for hosting the application,but only Ports supported by telegram should be used when the application is not hosted behind a reverse proxy

(back to top)

Installation

Heroku

Docker

Telegram Bot Commands

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Authors

(back to top)

License

MIT

(back to top)