Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
akhi07rx committed Jun 4, 2023
1 parent 1edb8a4 commit b0cfefe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions CoLab_torrent_downloader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"import time\n",
"from google.colab import drive\n",
"from tqdm import tqdm\n",
"import re\n",
"\n",
"drive.mount('/content/drive')\n",
"\n",
Expand All @@ -60,9 +59,8 @@
" 'storage_mode': lt.storage_mode_t.storage_mode_sparse,\n",
"}\n",
"\n",
"magnet_link_pattern = r'^magnet:\\?xt=urn:btih:[a-zA-Z0-9]{32,40}.*'\n",
"\n",
"while True:\n",
" print()\n",
" link = input(\"Enter the magnet link (or 'exit' to quit): \")\n",
" if link.lower() == 'exit':\n",
" break\n",
Expand All @@ -73,7 +71,7 @@
"\n",
" handle = lt.add_magnet_uri(ses, link, params)\n",
"\n",
" print(\"Downloading Metadata...\")\n",
" print(\"\\nDownloading Metadata...\")\n",
" while not handle.has_metadata():\n",
" time.sleep(1)\n",
" print(\"Got Metadata, Starting Torrent Download...\")\n",
Expand Down Expand Up @@ -102,9 +100,12 @@
" total_time_seconds = end_time - start_time\n",
" total_time_minutes = total_time_seconds / 60\n",
"\n",
" print(f\"File name: {torrent_info.name()}\")\n",
" num_files = torrent_info.num_files()\n",
"\n",
" print(f\"\\nFile name: {torrent_info.name()}\")\n",
" print(f\"File size: {file_size_str}\")\n",
" print(f\"Total Time: {total_time_seconds:.2f} seconds / {total_time_minutes:.2f} minutes\")\n",
" print(f\"Number of files: {num_files}\")\n",
" print(f\"Saved location: {save_path}\")\n"
]
}
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ This code allows you to download torrents directly to your Google Drive using Go
- Download torrents from magnet links
- Save downloaded files to a specified location on Google Drive
- Display a progress bar and information about the downloaded file
- Prompt the user to enter the magnet link or exit
- Handle incorrect inputs and display error messages

## Prerequisites

Expand All @@ -17,9 +19,9 @@ This code allows you to download torrents directly to your Google Drive using Go

1. Open the code in Google Colab.
2. Run the first cell to install the `libtorrent` library and mount your Google Drive.
3. Change the `link` variable to the magnet link of the torrent you want to download.
4. Change the `save_path` parameter to the location on your Google Drive where you want to save the downloaded file.
5. Run the rest of the code to start the torrent download.
3. When prompted, enter the magnet link of the torrent you want to download or 'exit' to quit.
4. If you enter an invalid magnet link, the code will display an error message and prompt you to try again.
5. The code will download the torrent and display a progress bar and information about the downloaded file.

## Code Components

Expand Down

0 comments on commit b0cfefe

Please sign in to comment.