Transfer error ...from torrent to gdrive....using colab

:point_down: :point_down:t4:

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libtorrent-rasterbar9
Suggested packages:
libtorrent-rasterbar-dbg
The following NEW packages will be installed:
libtorrent-rasterbar9 python3-libtorrent
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
Need to get 1,569 kB of archives.
After this operation, 5,718 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libtorrent-rasterbar9 amd64 1.1.5-1build1 [1,258 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python3-libtorrent amd64 1.1.5-1build1 [310 kB]
Fetched 1,569 kB in 0s (13.8 MB/s)
Selecting previously unselected package libtorrent-rasterbar9.
(Reading database … 149414 files and directories currently installed.)
Preparing to unpack …/libtorrent-rasterbar9_1.1.5-1build1_amd64.deb …
Unpacking libtorrent-rasterbar9 (1.1.5-1build1) …
Selecting previously unselected package python3-libtorrent.
Preparing to unpack …/python3-libtorrent_1.1.5-1build1_amd64.deb …
Unpacking python3-libtorrent (1.1.5-1build1) …
Setting up libtorrent-rasterbar9 (1.1.5-1build1) …
Setting up python3-libtorrent (1.1.5-1build1) …
Processing triggers for libc-bin (2.27-3ubuntu1.4) …
/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link


ModuleNotFoundError Traceback (most recent call last)
in ()
8 get_ipython().system(‘apt install python3-libtorrent’)
9
—> 10 import libtorrent as lt
11
12 ses = lt.session()

ModuleNotFoundError: No module named ‘libtorrent’


Use this code instead:

!apt install python3-libtorrent

import libtorrent as lt

ses = lt.session()
ses.listen_on(6881, 6891)
downloads =

Just running !apt install python3-libtorrent won’t do anything

@BadFella , doesn’t work bro… No module named libtorrent. until yesterday , it was working fine.

image

Use this:

!apt install libtorrent-rasterbar9

import libtorrent as lt

ses = lt.session()

ses.listen_on(6881, 6891)

downloads =

1 Like

@BadFella , same “No Module” error bro. I think it’s blocked…saw some videos on youtube and a lot people complaining about it not working anymore.

1 Like

I ran these two commands before running the above and it worked fine for me:

4 Likes

@BadFella , that worked but now python colab script is not working giving some KeyError: ‘unknown name in torrent params: paused’. Can you please share the colab notebook you are using

1 Like

thanks brother it worked for me. i was also finding the solution for many hours and your code worked

Cheers , mate…its working…
thanx :heart_eyes:

Thank you :star_struck:

@john_corner , bro can please share the colab notebook you’are using. Mine is not working.

I am also facing the same issue. Please somebody help.

could anyone share the colab file plz

Open Colab
Add the following lines in separate code segments. (New code after every line break.)

Install libtorrent and Initialize Session

!python -m pip install --upgrade pip setuptools wheel

!python -m pip install lbry-libtorrent

!apt install libtorrent-rasterbar9
import libtorrent as lt
ses = lt.session()
ses.listen_on(6881, 6891)
downloads = [ remove this text ]

Mount Google Drive

from google.colab import drive
drive.mount(“/content/drive”)

Add From Magnet Link

params = {“save_path”: “OUTPUT_FILE_PATH”}
while True:
magnet_link = input("Enter Magnet Link Or Type Exit: ")
if magnet_link.lower() == “exit”:
break
downloads.append(
lt.add_magnet_uri(ses, magnet_link, params)
)

Add From Torrent File

from google.colab import files
source = files.upload()
params = {
“save_path”: “OUTPUT_FILE_PATH”,
“ti”: lt.torrent_info(list(source.keys())[0]),
}
downloads.append(ses.add_torrent(params))

Check Download Progress

import time
from IPython.display import display
import ipywidgets as widgets
state_str = [
“queued”,
“checking”,
“downloading metadata”,
“downloading”,
“finished”,
“seeding”,
“allocating”,
“checking fastresume”,
]
layout = widgets.Layout(width=“auto”)
style = {“description_width”: “initial”}
download_bars = [
widgets.FloatSlider(
step=0.01, disabled=True, layout=layout, style=style
)
for _ in downloads
]
display(*download_bars)
while downloads:
next_shift = 0
for index, download in enumerate(downloads[:]):
bar = download_bars[index + next_shift]
if not download.is_seed():
s = download.status()
bar.description = " ".join(
[
download.name(),
str(s.download_rate / 1000),
“kB/s”,
state_str[s.state],
]
)
bar.value = s.progress * 100
else:
next_shift -= 1
ses.remove_torrent(download)
downloads.remove(download)
bar.close()
download_bars.remove(bar)
print(download.name(), “complete”)
time.sleep(1)

2 Likes

image
i added those two lines and it worked for me

!python -m pip install --upgrade pip setuptools wheel
!python -m pip install lbry-libtorrent

Will check iT out LAter

it worked buddy thanx

3 Likes

no problem