gitwtfhub

wtf is magnet-dht?

eternal-flame-ad/magnet-dht — explained in plain English

Analysis updated 2026-07-20 · repo last pushed 2018-07-06

PythonAudience · developerComplexity · 3/5DormantSetup · moderate

TL;DR

A Python tool that automatically collects magnet links from the BitTorrent network by joining its decentralized DHT network, storing them in Redis for deduplication.

Mindmap

mindmap
  root((repo))
    What it does
      Collects magnet links
      Joins DHT network
      Deduplicates in Redis
    Tech stack
      Python
      Redis
      aria2
      UDP
    Use cases
      Build search engine
      Research BitTorrent
      Convert to torrent files
    Audience
      Developers
      Researchers
      Curious learners
    Setup
      Needs Redis
      Optional aria2
      Runs best locally

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a search engine for downloadable BitTorrent content by harvesting magnet links at scale.

REASON 2

Research what types of files and resources are available on the BitTorrent DHT network.

REASON 3

Convert collected magnet links into torrent files and parse their contents to see what they contain.

REASON 4

Learn how decentralized peer-to-peer networks like DHT work by running a node that interacts with others.

What's in the stack?

PythonRedisaria2UDP

How it stacks up

eternal-flame-ad/magnet-dht0xallam/my-recipe0xhassaan/nn-from-scratch
Stars0
LanguagePythonPythonPython
Last pushed2018-07-062022-11-22
MaintenanceDormantDormant
Setup difficultymoderatemoderatemoderate
Complexity3/52/54/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires Redis installed and running, plus optionally aria2 if you want the magnet-to-torrent conversion feature.

No license information is provided, so copyright defaults apply and usage rights are unclear.

Wtf does this do

Magnet-dht is a tool that collects magnet links from the BitTorrent network automatically. If you've ever used a magnet link to download a file, you know it's a convenient way to find and fetch resources without needing a central server. This project essentially sits on the network and gathers those links by the millions, without relying on any specific website. The tool works by joining the Distributed Hash Table (DHT) network, which is the decentralized system BitTorrent clients use to find each other without a central tracker. The project pretends to be a DHT node, connects to other nodes using UDP, and asks around for resources. As other nodes share information, the tool collects the magnet links they reference. It stores everything in Redis to automatically deduplicate entries, and uses multiple threads and processes to speed things up. The author reports collecting over a million magnet links in about four hours on a decent laptop. Beyond just collecting links, the project can also convert those magnet links into actual torrent files using a tool called aria2, and then parse the torrent files to see what specific resources they contain. This would appeal to someone building a search engine for downloadable content, a researcher studying what's available on the BitTorrent network, or really anyone curious about how decentralized file sharing works under the hood. It's a hands-on way to harvest data directly from the source rather than scraping download links from websites. One notable thing is that the author built this partly out of frustration with existing Python DHT crawlers, which were either undocumented or not compatible with Python 3. The project reflects an interest-driven approach to learning rather than being production-hardened, and the author notes that running it on a low-spec cloud server didn't go as well as on a local machine. You'll need Redis installed and optionally aria2 if you want the magnet-to-torrent conversion feature.

Yoink these prompts

Prompt 1
Help me set up and run magnet-dht on my laptop. I have Python and Redis installed, what are the exact steps to start collecting magnet links from the BitTorrent DHT network?
Prompt 2
I've collected magnet links with magnet-dht and stored them in Redis. Write a Python script to query Redis, retrieve the magnet links, and use aria2 to convert them into torrent files.
Prompt 3
I want to use magnet-dht to collect magnet links and then parse the resulting torrent files to list the names and sizes of files inside each torrent. How should I structure this pipeline?
Prompt 4
I'm running magnet-dht on a low-spec VPS and it's not collecting many links. Help me debug whether it's a network, UDP, or threading issue, and suggest config changes to improve results.

Frequently asked questions

wtf is magnet-dht?

A Python tool that automatically collects magnet links from the BitTorrent network by joining its decentralized DHT network, storing them in Redis for deduplication.

What language is magnet-dht written in?

Mainly Python. The stack also includes Python, Redis, aria2.

Is magnet-dht actively maintained?

Dormant — no commits in 2+ years (last push 2018-07-06).

What license does magnet-dht use?

No license information is provided, so copyright defaults apply and usage rights are unclear.

How hard is magnet-dht to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is magnet-dht for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.