+{"cells":[{"cell_type":"code","execution_count":2,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":26017,"status":"ok","timestamp":1670423727944,"user":{"displayName":"Pushpesh Gokul Pant 20bcs062","userId":"08582588184349063162"},"user_tz":-330},"id":"L_aAubKzmk0k","outputId":"720a172e-4ef2-44d9-a472-521f6ca71f46"},"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive\n"]}],"source":["from google.colab import drive\n","drive.mount('/content/drive')"]},{"cell_type":"code","execution_count":3,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"zy3nhvet8hCM","executionInfo":{"status":"ok","timestamp":1670423744038,"user_tz":-330,"elapsed":16107,"user":{"displayName":"Pushpesh Gokul Pant 20bcs062","userId":"08582588184349063162"}},"outputId":"2cd354b0-ccdd-4354-a335-22f89651a496"},"outputs":[{"output_type":"stream","name":"stdout","text":["Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: pip in /usr/local/lib/python3.8/dist-packages (21.1.3)\n","Collecting pip\n"," Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)\n","\u001b[K |████████████████████████████████| 2.1 MB 9.6 MB/s \n","\u001b[?25hRequirement already satisfied: setuptools in /usr/local/lib/python3.8/dist-packages (57.4.0)\n","Collecting setuptools\n"," Downloading setuptools-65.6.3-py3-none-any.whl (1.2 MB)\n","\u001b[K |████████████████████████████████| 1.2 MB 51.6 MB/s \n","\u001b[?25hRequirement already satisfied: wheel in /usr/local/lib/python3.8/dist-packages (0.38.4)\n","Installing collected packages: setuptools, pip\n"," Attempting uninstall: setuptools\n"," Found existing installation: setuptools 57.4.0\n"," Uninstalling setuptools-57.4.0:\n"," Successfully uninstalled setuptools-57.4.0\n"," Attempting uninstall: pip\n"," Found existing installation: pip 21.1.3\n"," Uninstalling pip-21.1.3:\n"," Successfully uninstalled pip-21.1.3\n","\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","ipython 7.9.0 requires jedi>=0.10, which is not installed.\u001b[0m\n","Successfully installed pip-22.3.1 setuptools-65.6.3\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Collecting lbry-libtorrent\n"," Downloading lbry_libtorrent-1.2.4-py3-none-any.whl (2.4 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m37.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hInstalling collected packages: lbry-libtorrent\n","Successfully installed lbry-libtorrent-1.2.4\n","\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n","\u001b[0m"]}],"source":["!python -m pip install --upgrade pip setuptools wheel\n","!python -m pip install lbry-libtorrent"]},{"cell_type":"code","execution_count":4,"metadata":{"id":"r-ImAmjj8tdM","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1670423753028,"user_tz":-330,"elapsed":9018,"user":{"displayName":"Pushpesh Gokul Pant 20bcs062","userId":"08582588184349063162"}},"outputId":"bc845e4e-36af-4e26-c1cb-607fed410436"},"outputs":[{"name":"stdout","output_type":"stream","text":["magnet:?xt=urn:btih:47ddf56667e33d5092e4301900832a11ea80335c&dn=archlinux-2022.12.01-x86_64.iso\n"]}],"source":["link = input(\"\") # PASTE TORRENT/MAGNET LINK HERE"]},{"cell_type":"code","execution_count":6,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"S0iNMOxG8mCY","outputId":"32f39c8f-3aed-46e6-a711-a366663a522f","executionInfo":{"status":"ok","timestamp":1670425013309,"user_tz":-330,"elapsed":1102744,"user":{"displayName":"Pushpesh Gokul Pant 20bcs062","userId":"08582588184349063162"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["magnet:?xt=urn:btih:47ddf56667e33d5092e4301900832a11ea80335c&dn=archlinux-2022.12.01-x86_64.iso\n","2022-12-07 14:38:30.378900\n","Downloading Metadata...\n","Got Metadata, Starting Torrent Download...\n","Starting archlinux-2022.12.01-x86_64.iso\n","0.00% complete (down: 6.8 kb/s up: 0.8 kB/s peers: 8) downloading \n","2.47% complete (down: 2898.0 kb/s up: 116.3 kB/s peers: 41) downloading \n","4.94% complete (down: 4023.9 kb/s up: 166.7 kB/s peers: 53) downloading \n","7.07% complete (down: 4163.6 kb/s up: 165.9 kB/s peers: 72) downloading \n","9.79% complete (down: 4783.3 kb/s up: 185.7 kB/s peers: 73) downloading \n","12.50% complete (down: 4709.2 kb/s up: 193.3 kB/s peers: 90) downloading \n","15.29% complete (down: 5082.3 kb/s up: 205.3 kB/s peers: 95) downloading \n","18.02% complete (down: 5036.6 kb/s up: 197.9 kB/s peers: 111) downloading \n","20.88% complete (down: 5056.7 kb/s up: 204.0 kB/s peers: 111) downloading \n","24.21% complete (down: 5839.0 kb/s up: 244.2 kB/s peers: 131) downloading \n","27.70% complete (down: 5856.8 kb/s up: 244.0 kB/s peers: 131) downloading \n","31.17% complete (down: 6082.6 kb/s up: 260.1 kB/s peers: 137) downloading \n","34.10% complete (down: 5524.8 kb/s up: 230.8 kB/s peers: 141) downloading \n","36.67% complete (down: 4986.9 kb/s up: 213.5 kB/s peers: 148) downloading \n","39.34% complete (down: 4868.0 kb/s up: 214.4 kB/s peers: 152) downloading \n","41.91% complete (down: 4832.3 kb/s up: 216.2 kB/s peers: 151) downloading \n","44.46% complete (down: 4714.2 kb/s up: 211.2 kB/s peers: 154) downloading \n","47.51% complete (down: 5195.8 kb/s up: 239.6 kB/s peers: 150) downloading \n","50.30% complete (down: 5083.6 kb/s up: 233.4 kB/s peers: 150) downloading \n","52.98% complete (down: 4916.5 kb/s up: 217.7 kB/s peers: 148) downloading \n","55.61% complete (down: 4875.6 kb/s up: 215.8 kB/s peers: 146) downloading \n","58.18% complete (down: 4658.6 kb/s up: 210.1 kB/s peers: 147) downloading \n","60.66% complete (down: 4522.8 kb/s up: 200.2 kB/s peers: 149) downloading \n","62.97% complete (down: 4277.2 kb/s up: 192.5 kB/s peers: 148) downloading \n","65.53% complete (down: 4408.0 kb/s up: 200.0 kB/s peers: 150) downloading \n","68.01% complete (down: 4519.5 kb/s up: 200.3 kB/s peers: 153) downloading \n","70.47% complete (down: 4494.3 kb/s up: 207.8 kB/s peers: 155) downloading \n","72.94% complete (down: 4424.8 kb/s up: 207.4 kB/s peers: 159) downloading \n","75.55% complete (down: 4702.1 kb/s up: 213.4 kB/s peers: 162) downloading \n","77.98% complete (down: 4573.2 kb/s up: 208.0 kB/s peers: 166) downloading \n","80.29% complete (down: 4212.1 kb/s up: 193.1 kB/s peers: 165) downloading \n","82.65% complete (down: 4299.2 kb/s up: 194.3 kB/s peers: 167) downloading \n","85.52% complete (down: 4820.7 kb/s up: 212.4 kB/s peers: 172) downloading \n","88.23% complete (down: 4829.8 kb/s up: 214.1 kB/s peers: 175) downloading \n","90.90% complete (down: 4818.3 kb/s up: 212.3 kB/s peers: 171) downloading \n","93.62% complete (down: 4858.7 kb/s up: 214.9 kB/s peers: 171) downloading \n","96.13% complete (down: 4593.6 kb/s up: 209.2 kB/s peers: 173) downloading \n","98.22% complete (down: 4313.2 kb/s up: 203.8 kB/s peers: 175) downloading \n","99.81% complete (down: 4064.9 kb/s up: 205.7 kB/s peers: 176) downloading \n","archlinux-2022.12.01-x86_64.iso COMPLETE\n","Elapsed Time: 18 min : 22 sec\n","2022-12-07 14:56:52.608228\n"]}],"source":["import libtorrent as lt\n","import time\n","import datetime\n","\n","ses = lt.session()\n","ses.listen_on(6881, 6891)\n","params = {\n"," 'save_path': '/content/drive/My Drive/Torrent/',\n"," 'storage_mode': lt.storage_mode_t(2)}\n","\n","print(link)\n","\n","handle = lt.add_magnet_uri(ses, link, params)\n","ses.start_dht()\n","\n","begin = time.time()\n","print(datetime.datetime.now())\n","\n","print ('Downloading Metadata...')\n","while (not handle.has_metadata()):\n"," time.sleep(1)\n","print ('Got Metadata, Starting Torrent Download...')\n","\n","print(\"Starting\", handle.name())\n","\n","while (handle.status().state != lt.torrent_status.seeding):\n"," s = handle.status()\n"," state_str = ['queued', 'checking', 'downloading metadata', \\\n"," 'downloading', 'finished', 'seeding', 'allocating']\n"," print ('%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s ' % \\\n"," (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \\\n"," s.num_peers, state_str[s.state]))\n"," time.sleep(5)\n","\n","end = time.time()\n","print(handle.name(), \"COMPLETE\")\n","\n","print(\"Elapsed Time: \",int((end-begin)//60),\"min :\", int((end-begin)%60), \"sec\")\n","\n","print(datetime.datetime.now())"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"rXDX_B6W86MS"},"outputs":[],"source":[]}],"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyM2KZ9bGayqwYEf9Pj4mp3H"},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0}
0 commit comments