# How To Create Own Torrent To G-drive Telegram Bot-1

**URL:** <https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330>\
**Category:** Tools & Scripts\
**Tags:** programming, cloud-storage, social-media\
**Created:** [May 13, 2020, 6:43pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330 "2020-05-13T18:43:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Sam](https://onehack.st/user_avatar/onehack.st/mr_sam/32/31912_2.png) [@Mr\_Sam](https://onehack.st/u/Mr_Sam)\
**Post date:** [May 13, 2020, 6:43pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/1 "2020-05-13T18:43:21Z")

</div>

A telegram bot for all your mirror needs

# What is this repo about?

This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive.

# Inspiration

This project is heavily inspired from @out386 's telegram bot which is written in JS.

# Features supported:

- Mirroring direct download links to google drive
- Download progress
- Upload progress
- Download/upload speeds and ETAs
- Docker support
- Uploading To Team Drives.
- Index Link support
- Service account support
- Mirror all youtube-dl supported links
- Mirror telegram files

# How to deploy in Heroku?

Hit the deploy to heroku button and follow the further instructions in the screen:

**NB: Usage of Aria2 may leads to the suspension of your heroku account so deploy at your own risk.**

[![Deploy](https://camo.githubusercontent.com/83b0e95b38892b49184e07ad572c94c8038323fb/68747470733a2f2f7777772e6865726f6b7563646e2e636f6d2f6465706c6f792f627574746f6e2e737667)](https://heroku.com/deploy?template=https://github.com/CW4RR10R/python-aria-mirror-bot/tree/master)

## Getting Google OAuth API credential or SECRET\_JSON

- Visit the [Google Cloud Console](https://console.developers.google.com/apis/credentials)
- Go to the OAuth Consent tab, fill it, and save.
- Go to the Credentials tab and click Create Credentials → OAuth Client ID
- Choose Other and Create.
- Visit [Google API page](https://console.developers.google.com/apis/library)
- Search for Drive and enable it if it is disabled
- Finally, run the script to generate SECRET\_JSON for Google Drive

```auto
pip install oauth2client

```

```auto
python3 generate_drive_token.py

```

OR use online terminal

[![Run](https://camo.githubusercontent.com/8476794e1bf63fbf93f15865a974384fc0b76315/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52756e2532304f6e6c696e652d526564)](https://gdrive-auth.cw4rr10r.repl.run/)

**Termux:**

`pkg install python wget`

`wget https://raw.githubusercontent.com/CW4RR10R/python-aria-mirror-bot/master/generate_drive_token.py`

`pip install oauth2client`

`python3 generate_drive_token.py`

Fill up rest of the fields in app.json. Meaning of each fields are discussed below:

- **BOT\_TOKEN** : The telegram bot token that you get from @BotFather
- **GDRIVE\_FOLDER\_ID** : This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
- **DOWNLOAD\_DIR** : The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD\_STATUS\_UPDATE\_INTERVAL** : A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it 5 seconds at least)
- **OWNER\_ID** : The Telegram user ID (not username) of the owner of the bot
- **AUTO\_DELETE\_MESSAGE\_DURATION** : Interval of time (in seconds), after which the bot deletes it’s message (and command message) which is expected to be viewed instantly. Note: Set to -1 to never automatically delete messages
- **IS\_TEAM\_DRIVE** : (Optional field) Set to “True” if GDRIVE\_FOLDER\_ID is from a Team Drive else False or Leave it empty.
- **USE\_SERVICE\_ACCOUNTS** : (Optional field) (Leave empty if unsure) Whether to use service accounts or not. For this to work see “Using service accounts” section below.
- **INDEX\_URL** : (Optional field) Refer to [https://github.com/maple3142/GDIndex/](https://github.com/maple3142/GDIndex/) The URL should not have any trailing ‘/’
- **API\_ID** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from [https://my.telegram.org](https://my.telegram.org/) DO NOT put this in quotes.
- **API\_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from [https://my.telegram.org](https://my.telegram.org/)
- **SESSION\_STRING** : Session string generated by running:

```auto
pip install pyrogram tgcrypto

```

```auto
python3 generate_string_session.py

```

OR use online terminal

[![Run](https://camo.githubusercontent.com/8476794e1bf63fbf93f15865a974384fc0b76315/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52756e2532304f6e6c696e652d526564)](https://gen-session.cw4rr10r.repl.run/)

**Termux:**

`pkg install python wget` (if not installed earlier)

`wget https://raw.githubusercontent.com/CW4RR10R/python-aria-mirror-bot/master/generate_string_session.py`

`pip install pyrogram tgcrypto`

`python3 generate_string_session.py`

Note: You can limit maximum concurrent downloads by changing the value of MAX\_CONCURRENT\_DOWNLOADS in aria.sh. By default, it’s set to 2

# Youtube-dl authentication using .netrc file

For using your premium accounts in youtube-dl, edit the netrc file (in the root directory of this repository) according to following format:

```auto
machine host login username password my_youtube_password

```

where host is the name of extractor (eg. youtube, twitch). Multiple accounts of different hosts can be added each separated by a new line

## GitHub:

[https://github.com/CW4RR10R/python-aria-mirror-bot/](https://github.com/CW4RR10R/python-aria-mirror-bot/)

Video if you want to see the steps: [https://www.youtube.com/watch?v=07Pj9YLdpM4](https://www.youtube.com/watch?v=07Pj9YLdpM4) (This video made by infotelbot)

---

<div class="post-metadata">

**Author:** ![Aina](https://onehack.st/user_avatar/onehack.st/aina/32/167469_2.png) [@Aina](https://onehack.st/u/Aina)\
**Post date:** [May 13, 2020, 6:52pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/2 "2020-05-13T18:52:39Z")

</div>

@Mr_Sam I’m surprised, You took a good subject but content that you’ve trying to put here, it wasn’t welcome, it was promoting another resource instead of adding the real one. GitHub is the main source, what you had done it was source who dumped it just like that. anyway, Read the FAQ for better understanding, else PM me anytime!

## Description has been Modified. Category has been changed.

# 

## Thanks for the contribution.

---

<div class="post-metadata">

**Author:** ![Mr\_Sam](https://onehack.st/user_avatar/onehack.st/mr_sam/32/31912_2.png) [@Mr\_Sam](https://onehack.st/u/Mr_Sam)\
**Post date:** [May 13, 2020, 7:29pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/3 "2020-05-13T19:29:14Z")

</div>

Sorry for that. It was my first post, I should have read FAQ first. It will not happen again, And I was sure that any mistake will be fixed by you which why I just posted it.  
Thanks for the help and suggesion..

---

<div class="post-metadata">

**Author:** ![Atik](https://onehack.st/user_avatar/onehack.st/atik/32/19380_2.png) [@Atik](https://onehack.st/u/Atik)\
**Post date:** [May 14, 2020, 4:32pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/4 "2020-05-14T16:32:24Z")

</div>

The bot stucked after one download 🙄  
Any solution 😬

---

<div class="post-metadata">

**Author:** ![Monkeyd\_Luffy](https://onehack.st/user_avatar/onehack.st/monkeyd_luffy/32/25514_2.png) [@Monkeyd\_Luffy](https://onehack.st/u/Monkeyd_Luffy)\
**Post date:** [May 14, 2020, 8:18pm UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/5 "2020-05-14T20:18:02Z")

</div>

Me Too 😬 😬 😬, i have follow step by step but no lucky in download.  
the script isn’t strong tob handled. 🤣 🤣 🤣 🤣 🤣

---

<div class="post-metadata">

**Author:** ![Adnan\_Catper](https://onehack.st/user_avatar/onehack.st/adnan_catper/32/18110_2.png) [@Adnan\_Catper](https://onehack.st/u/Adnan_Catper)\
**Post date:** [July 28, 2020, 7:44am UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/6 "2020-07-28T07:44:40Z")

</div>

any update\> is it working?  
btw does it support torrent leech?

---

<div class="post-metadata">

**Author:** ![kerfuffle](https://onehack.st/user_avatar/onehack.st/kerfuffle/32/33308_2.png) [@kerfuffle](https://onehack.st/u/kerfuffle)\
**Post date:** [July 28, 2020, 9:11am UTC](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot-1/86330/7 "2020-07-28T09:11:54Z")

</div>

The original repo isn’t supported for heroku anymore
