Git Product home page Git Product logo

torrenthunt's Introduction

Stars Forks visitors Contributors Subscribe my channel H9

Torrent Hunt Bot

πŸ” Torrent Hunt Bot

Torrent Hunt Bot is a telegram bot to search and explore torrents from different sources. It can show you the result of your query in a snap. Furthermore, you can explore top, trending, & popular torrents and browse torrents of a certain category.

🌐 Supported Torrent Sources

β›² Features

  • Superfast and good pagination
  • Supports 18 different languages
  • Custom query search
  • Explore trending, popular, and top torrents
  • Browse torrents of a certain category
  • Get info, images, magnet link and .Torrent file of the torrent
  • Get the shortened URL of the magnet link
  • Supports inline query with thumbnail
  • Restriction mode to hide explicit content
  • Directly add the torrent in your seedr account
  • Auto typo correction and suggestions

πŸ—£οΈ Languages

Torrent Hunt Bot can talk in 19 different languages.

  • Arabic (Added by Omar Khalid)
  • Bengali (Verified by sobuj53)
  • Belarusian
  • Catalan
  • Dutch
  • English (Verified)
  • French
  • German
  • Hindi
  • Italian (Verified by bacchilega)
  • Korean
  • Malay
  • Nepali
  • Polish (Verified by Oskar)
  • Portuguese
  • Russian
  • Spanish
  • Turkish (Verified by Berce)
  • Ukrainian

Unverified languages are translated with Google Translator and may contain errors. Feel free to create a Pull Request with modifications to the language.json file.

While making a PR, make sure to add yourself and a verified tag on the language.


πŸ”‘ License

If you want to host this bot for public use, you shall not remove or replace our links.

See LICENSE for more information.


βš’οΈ Deployment

  • Clone the repository, create a virtual environment, and install the requirements

    git clone https://github.com/hemantapkh/torrenthunt && virtualenv env && source env/bin/activate && cd torrenthunt && pip install -r requirements.txt
  • Host the Torrents-API on your own server for better performance or leave it default. This API will be used for inline query only.

  • Edit the src/sample-config.json file and rename it to config.json

    βš™οΈ Click here to see a sample config file
    {
    "botToken": "<BOT Token>",
    
    "connectionType": "polling",
    
    "webhookOptions":{
        "webhookHost": null,
        
        "webhookPort": null,
        
        "webhookListen": "0.0.0.0",
        
        "sslCertificate": null,
        
        "sslPrivateKey": null
    },
    
    "adminId" : "<Admin UserId>", 
    
    "database": "torrenthunt.sqlite",
    
    "magnetDatabase": "magnets.sqlite",
    
    "cache": "cache",
    
    "cacheTime": 86400,
    
    "language": "language.json",
    
    "apiLink": "https://torrents-api.ryukme.repl.co/api" 
    }
  • Run the migration.py file to open a database.

    python migrations.py
  • Now, start the bot polling

    python torrenthunt.py

πŸš€ Webhook Deployment

While polling and webhooks both accomplish the same task, webhooks are far more efficient. Polling sends a request for new events (specifically, Create, Retrieve, and Delete events, which signal changes in data) at a predetermined frequency and waits for the endpoint to respond whereas, webhooks only transfer data when there is new data to send, making them 100% efficient. That means that polling creates, on average, 66x more server load than webhooks. (r)

  • Generate an SSL certificate

    >> openssl genrsa -out sslPrivateKey.pem 2048
    >> openssl req -new -x509 -days 3650 -key sslPrivateKey.pem -out sslCertificate.pem

    "Common Name (e.g. server FQDN or YOUR name)" should be your Host IP.

  • Rename the src/sample-config.json file to config.json and set

    • connectionType = webhook
    • webhookHost = IP/Host where the bot is running
    • webhookPort = PORT (Need to be opened)
    • webhookListen = 0.0.0.0 or IP address in some VPS
    • sslCertificate = Directory of SSL certificate
    • sslPrivateKey = Directory of SSL private key
  • And, start the aioHttp server.

    python torrenthunt.py

πŸ›Ί Auto deployment on every push

You can set up GitHub actions to update the bot automatically on every push.

  • Fork the repository on your GitHub account.

  • Create a directory

    mkdir /opt/TorrentHunt && cd /opt/TorrentHunt

    You should create a directory with the same name as above inside /opt, or edit the deploy.yml and deployScript.sh

  • Create a virtual environment in the directory with name env

    virtualenv env
  • Clone the repository and install the requirements in the virtual environment

    git clone https://github.com/hemantapkh/TorrentHunt && cd TorrentHunt && source /opt/TorrentHunt/env/bin/activate && pip install -r requirements.txt
  • Create a database and move the database into /opt/TorrentHunt

    python migrations.py && mv database.sqlite /opt/TorrentHunt
  • Generate SSH keys for your VPS and keep the private key in your GitHub secrets

    • Create the ssh key pair using the ssh-keygen command. You must leave the passphrase empty while generating the SSH key.
    • Copy and install the public ssh key on the server using sh-copy-id -i your_public_key user@host command or add the content of the public key in ~/.ssh/authorized_keys.
    • Now, copy the content of the private key and paste it on your GitHub secrets with the name SSHKEY. (Repository settings >> secrets >> New repository secret)
  • Create another GitHub secret with name HOST and save your Host IP.

  • Rename the src/sample-config.json file to config.json and set

    • database = /opt/TorrentHunt/database.sqlite
    • If you are using webhooks, copy the SSL certificate and private key in /opt/TorrentHunt and set
      • sslCertificate = /opt/TorrentHunt/sslCertificate.pem
      • sslPrivateKey = /opt/TorrentHunt/sslPrivateKey.pem
  • Copy the content of the edited config.json and save it on your repository secrets with name CONFIG. Don't forget to wrap the content of config file with single quotes like this 'Content of config.json'.

  • And, start the bot.

    source /opt/TorrentHunt/env/bin/activate && screen -dm python /opt/TorrentHunt/TorrentHunt/torrenthunt.py

Now, every time you push on the main branch, the bot automatically gets updated.


πŸ’š Contributing

Any contributions you make are greatly appreciated.

For minor fix, you can directly create a pull request and for adding a new feature, let's first discuss it in our telegram group or in GitHub Discussion.

πŸ™ Special thanks to Ryuk-me for creating Torrents-Api which is used for inline query in Torrent Hunt.


❇️ Made using 1337x and pyTelegramBotApi in PythonπŸ’™ by Hemanta Pokharel [βœ‰οΈ πŸ’¬ πŸ“Ί]

torrenthunt's People

Contributors

bacchilega avatar bercedev avatar dishapatel010 avatar hemantapkh avatar omvrkhvlid avatar sobuj53 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.