# Download torrent file with google colab with 2 lines of code

**URL:** <https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231>\
**Category:** Tutorials & Methods\
**Tags:** tips-tricks\
**Created:** [March 13, 2020, 3:43pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231 "2020-03-13T15:43:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 13, 2020, 3:43pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/1 "2020-03-13T15:43:24Z")

</div>

Have you ever thought of downloading a Torrent and saving it directly to Google Drive? I found one trick to do this using Google Colab and you will be able with 2 lines of code.

First open [Google Colab](https://colab.research.google.com/notebooks/intro.ipynb) and click ‘New Python 3 Notebook’. If you have ever used Jupyter Notebook you know what to do.  
Open Runtime and change runtime type to GPU ( be sure that you are using Python 3).

 ![image](https://onehack.st/uploads/default/original/3X/a/1/a142ffb9b613ba758fe9c3660ee0b67b6c8a689e.png)

after this you look at the right and press connect, choose hosted runtime

 ![image](https://onehack.st/uploads/default/original/3X/0/c/0c2c8cf20df0dbceb4afd9b888afae7abee2c534.png)

wait until ok

 ![image](https://onehack.st/uploads/default/original/3X/5/b/5b28ce2916142a4ee232dd36b6b77c049bfb3d73.png)

Go to left side bar and choose Files in menu and MOUNT DRIVE  
Execute that script and you will get the link to auth your account. Click the link, select your account that you want to use as a google drive storage. Allow the permission and you will get the code to auth your Gdrive. Copy the code, back to your Notebook, paste the code in the box under the sentence ‘Enter your authorization code:’, then click enter.

 ![image](https://onehack.st/uploads/default/original/3X/6/b/6bd220092408ed6f2ae939d554db7c026e92ffdf.png)

If is ok you will see you will see your drive in the sidebar by expand ‘drive’ folder

Now install transmission-cli and you can download torrent with command line using transmission-cli. If you often use Linux and prefer to use other programs besides transmission-cli, go for it. Install transmission-cli by executing this command in block code.

line of code  
!apt-get install transmission-cli

wait install complete

Now you are able to start your torrent download  
Let’s see, ‘/content/drive/My Drive’ is your root Gdrive folder. If you want to download the file to subfolder, just add the name of the subfolder at the end.

Here is how to download torrent use this code and your torrent link

!transmission-cli -w ‘/content/drive/My Drive’ [https://the](https://the) place with torrent.any/download/name of file.torrent

Wait until your file is downloaded and you will see the file in your drive.

ps: you can change the location whre you will put the file, and you also can use magnet link

Very easy and also very fast

---

<div class="post-metadata">

**Author:** ![Aryaman\_Purkait](https://onehack.st/user_avatar/onehack.st/aryaman_purkait/32/96918_2.png) [@Aryaman\_Purkait](https://onehack.st/u/Aryaman_Purkait)\
**Post date:** [March 13, 2020, 5:28pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/2 "2020-03-13T17:28:12Z")

</div>

I would be grateful if you could show me the screenshot of an example through this code.

---

<div class="post-metadata">

**Author:** ![rawn7702](https://onehack.st/user_avatar/onehack.st/rawn7702/32/104678_2.png) [@rawn7702](https://onehack.st/u/rawn7702)\
**Post date:** [March 14, 2020, 7:14am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/3 "2020-03-14T07:14:03Z")

</div>

Hi, @jmpinto  
I have tried this and it gives me an error saying that  
`transmission-cli 2.92 (14714) [2020-03-14 07:09:19.202] Couldn't create "/content/drive/Shared Drives": Operation not supported Unable to create download directory "/content/drive/Shared Drives/1st GDrive/Movies/3DBuzz": Operation not supported`

---

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 14, 2020, 11:04am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/4 "2020-03-14T11:04:23Z")

</div>

> [@jmpinto](#):
>
> transmission-cli -w ‘/content/drive/My Drive’ [https://the](https://the)

You need to see how the Shared drive apears in the right side of the screen

---

<div class="post-metadata">

**Author:** ![dev\_coder](https://onehack.st/user_avatar/onehack.st/dev_coder/32/20023_2.png) [@dev\_coder](https://onehack.st/u/dev_coder)\
**Post date:** [March 14, 2020, 11:23am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/5 "2020-03-14T11:23:37Z")

</div>

Hi, can you please make a video demo for this? It will be very helpful.

---

<div class="post-metadata">

**Author:** ![Aryaman\_Purkait](https://onehack.st/user_avatar/onehack.st/aryaman_purkait/32/96918_2.png) [@Aryaman\_Purkait](https://onehack.st/u/Aryaman_Purkait)\
**Post date:** [March 14, 2020, 11:47am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/6 "2020-03-14T11:47:19Z")

</div>

Yes please!

---

<div class="post-metadata">

**Author:** ![NAehs\_justn](https://onehack.st/user_avatar/onehack.st/naehs_justn/32/20860_2.png) [@NAehs\_justn](https://onehack.st/u/NAehs_justn)\
**Post date:** [March 14, 2020, 12:25pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/7 "2020-03-14T12:25:06Z")

</div>

Hello @jmpinto but how do you get 358 GB on google collab as I am only getting 68GB

---

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 14, 2020, 12:32pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/8 "2020-03-14T12:32:43Z")

</div>

Hi  
Ok This I can help  
When you call Google Colab, you have Runtime up, ok?  
So you can go and press your mouse in it that will open some options, has one that says: Change Runtime type, when you get in this option you will see that you will open a window and there you need to put Python 3 and than in hadware acelarator you put GPU, and this is all that you need.

---

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 14, 2020, 12:34pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/9 "2020-03-14T12:34:56Z")

</div>

Hi,  
First I do not have all this time, second I do not have an util to do that.  
But this is simple thing, and I just saw it at internet and also I tryed and works, just read and look at the pictures an try you will be able as I was.

---

<div class="post-metadata">

**Author:** ![NAehs\_justn](https://onehack.st/user_avatar/onehack.st/naehs_justn/32/20860_2.png) [@NAehs\_justn](https://onehack.st/u/NAehs_justn)\
**Post date:** [March 14, 2020, 12:37pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/10 "2020-03-14T12:37:16Z")

</div>

@jmpinto I have already selected the gpu as the hardware accelerator with python 3 and I am still getting only 68GB

---

<div class="post-metadata">

**Author:** ![NAehs\_justn](https://onehack.st/user_avatar/onehack.st/naehs_justn/32/20860_2.png) [@NAehs\_justn](https://onehack.st/u/NAehs_justn)\
**Post date:** [March 14, 2020, 12:37pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/11 "2020-03-14T12:37:47Z")

</div>

By any chance are you using colab pro?

---

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 14, 2020, 3:48pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/12 "2020-03-14T15:48:43Z")

</div>

I will check and let me see if I can discover what happens  
Tham I will post here

---

<div class="post-metadata">

**Author:** ![jmpinto](https://onehack.st/user_avatar/onehack.st/jmpinto/32/26546_2.png) [@jmpinto](https://onehack.st/u/jmpinto)\
**Post date:** [March 14, 2020, 3:50pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/13 "2020-03-14T15:50:15Z")

</div>

Nope,  
I think that maybe Google made changes in what they are offering theses days, since has more than 6 months that I do not work with it.  
Anyway later today I will check this

---

<div class="post-metadata">

**Author:** ![Aryaman\_Purkait](https://onehack.st/user_avatar/onehack.st/aryaman_purkait/32/96918_2.png) [@Aryaman\_Purkait](https://onehack.st/u/Aryaman_Purkait)\
**Post date:** [March 15, 2020, 3:17am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/14 "2020-03-15T03:17:52Z")

</div>

@NAehs_justn don’t connect to GPU and you will get about 108 GB.

---

<div class="post-metadata">

**Author:** ![Keke\_Bija](https://onehack.st/user_avatar/onehack.st/keke_bija/32/37186_2.png) [@Keke\_Bija](https://onehack.st/u/Keke_Bija)\
**Post date:** [March 22, 2020, 5:59am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/15 "2020-03-22T05:59:01Z")

</div>

I had uploaded and downloaded torrent using this trick

_\> [https://colab.research.google.com/github/FKLC/Torrent-To-Google-Drive-Downloader/blob/master/Torrent\_To\_Google\_Drive\_Downloader.ipynb](https://colab.research.google.com/github/FKLC/Torrent-To-Google-Drive-Downloader/blob/master/Torrent_To_Google_Drive_Downloader.ipynb)_

It is similar to this only just run the code nd u got it

Also u can download torrent using .torrent file and also using magnet link

I have searched it on google nd find this just go nd download torrent using google drive

 ![torrnt](https://onehack.st/uploads/default/original/3X/5/7/572b01cc09b5fad4e243ed731c5cb127fb999a65.jpeg)

In this you can see i have downloaded one movie **Onward** using torrent

---

<div class="post-metadata">

**Author:** ![quick-learner](https://onehack.st/user_avatar/onehack.st/quick-learner/32/43997_2.png) [@quick-learner](https://onehack.st/u/quick-learner)\
**Post date:** [March 22, 2020, 6:14am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/16 "2020-03-22T06:14:35Z")

</div>

i’am getting this error

 ![image](https://onehack.st/uploads/default/original/3X/d/6/d66f0536cc7944be3f3412ebce8808a3d55f7f90.png)

---

<div class="post-metadata">

**Author:** ![Pillu\_Kalra](https://onehack.st/user_avatar/onehack.st/pillu_kalra/32/22542_2.png) [@Pillu\_Kalra](https://onehack.st/u/Pillu_Kalra)\
**Post date:** [March 22, 2020, 7:13am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/17 "2020-03-22T07:13:45Z")

</div>

> “/content/drive/Shared Drives”

I believe it’s “Team Drives” instead of Shared Drives.  
Try Running this command:

```auto
from google.colab import drive
drive.mount('/content/gdrive')
!ls /content/gdrive

```

should output something like this:

```
'My Drive' 'Team Drives'

```

Source: Github Repo Issues Google Collab

---

<div class="post-metadata">

**Author:** ![Pillu\_Kalra](https://onehack.st/user_avatar/onehack.st/pillu_kalra/32/22542_2.png) [@Pillu\_Kalra](https://onehack.st/u/Pillu_Kalra)\
**Post date:** [March 22, 2020, 7:38am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/18 "2020-03-22T07:38:56Z")

</div>

Neat Trick!

---

<div class="post-metadata">

**Author:** ![Mishkat\_Rahman](https://onehack.st/user_avatar/onehack.st/mishkat_rahman/32/1463_2.png) [@Mishkat\_Rahman](https://onehack.st/u/Mishkat_Rahman)\
**Post date:** [March 22, 2020, 7:50am UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/19 "2020-03-22T07:50:59Z")

</div>

Guys, just to say, I used to use this method but Google simply restricts you after certain amount of usage (network usage). Even they won’t let you connect to the normal backend, let alone the GPU one. After around one month, they lifted my restriction. So be careful when using Colab to download torrent.

---

<div class="post-metadata">

**Author:** ![29rohitkr](https://onehack.st/user_avatar/onehack.st/29rohitkr/32/30930_2.png) [@29rohitkr](https://onehack.st/u/29rohitkr)\
**Post date:** [March 27, 2020, 5:22pm UTC](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231/20 "2020-03-27T17:22:52Z")

</div>

try using in magnet link

[Next page](https://onehack.st/t/download-torrent-file-with-google-colab-with-2-lines-of-code/73231.md?page=2)
