{"id":13815123,"url":"https://github.com/gallexis/PyTorrent","last_synced_at":"2025-05-15T07:31:56.488Z","repository":{"id":32839218,"uuid":"36432588","full_name":"gallexis/PyTorrent","owner":"gallexis","description":"Simple BitTorrent client made in Python - Use for learning","archived":false,"fork":false,"pushed_at":"2023-07-25T11:51:04.000Z","size":170,"stargazers_count":330,"open_issues_count":4,"forks_count":88,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-05T21:10:02.541Z","etag":null,"topics":["bittorrent","bittorrent-client","bittorrent-network","p2p","peer-2-peer","peer-to-peer","python","python-3","torrent"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gallexis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-05-28T10:58:33.000Z","updated_at":"2025-03-29T18:59:22.000Z","dependencies_parsed_at":"2024-01-15T13:35:39.625Z","dependency_job_id":null,"html_url":"https://github.com/gallexis/PyTorrent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gallexis%2FPyTorrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gallexis%2FPyTorrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gallexis%2FPyTorrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gallexis%2FPyTorrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gallexis","download_url":"https://codeload.github.com/gallexis/PyTorrent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254295945,"owners_count":22047175,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bittorrent","bittorrent-client","bittorrent-network","p2p","peer-2-peer","peer-to-peer","python","python-3","torrent"],"created_at":"2024-08-04T04:02:59.423Z","updated_at":"2025-05-15T07:31:55.738Z","avatar_url":"https://github.com/gallexis.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n# PyTorrent\n\n\nPyTorrent is a CLI tool that downloads files from the **BitTorrent** network.\n\nI wanted to make my own functional and straightforward program to learn how does BitTorrent protocol work and improve my python skills.\n\nIt is almost written from scratch with python 3.7, only the pubsub library was used to create events when a new peer is connected, or when data is received from a peer.\nYou first need to wait for the program to connect to some peers first, then it starts downloading.\n\nThis tool needs a lot of improvements, but it does its job, you can :\n-\tRead a torrent file\n-\tScrape udp or http trackers\n-\tConnect to peers\n-\tAsk them for the blocks you want\n-\tSave a block in RAM, and when a piece is completed and checked, write the data into your hard drive\n-\tDeal with the one-file or multi-files torrents\n-\tLeech or Seed to other peers\n\nBut you can’t :\n-\tDownload more than one torrent at a time\n-\tBenefit of a good algorithm to ask your peers for blocks (code of rarest piece algo is implemented but not used yet)\n-\tPause and resume download\n\nDon't hesitate to ask me questions if you need help, or send me a pull request for new features or improvements.\n\n### Installation\nYou can run the following command to install the dependencies using pip\n\n`pip install -r requirements.txt`\n\n:boom: Because it's using the \"select\" function, this code will not be able to run on Windows: [python-select-on-windows](https://stackoverflow.com/a/22254123/3170071)\n\n### Running the program\n\nSimply run:\n`python main.py /path/to/your/file.torrent`\n\nThe files will be downloaded in the same path as your main.py script.\n\n### Sources :\n\nI wouldn't have gone that far without the help of\n[Lita](https://github.com/lita/bittorrent \"Lita\"), \n[Kristen Widman's](http://www.kristenwidman.com/blog/how-to-write-a-bittorrent-client-part-1 \"Kristen Widman's blog\") \u0026 the\n[Bittorrent Unofficial Spec](https://wiki.theory.org/BitTorrentSpecification \"Bittorrent Unofficial Spec\"), so thank you.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgallexis%2FPyTorrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgallexis%2FPyTorrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgallexis%2FPyTorrent/lists"}