Magnet Parser
A Python library for parsing magnet links and extracting their components, designed to simplify interactions with torrent files.
Table of Contents
Introduction
The Magnet Parser library allows users to decode magnet links, extracting essential metadata such as the info hash, name, and tracker URLs. This functionality is particularly useful for applications that manage or interact with torrent files, enabling seamless integration with torrent clients.
Installation
To install the magnet_parser library, you can use pip:
pip install magnet-parser
from magnet_parser import *
# Example magnet link
magnet_link = "magnet:?xt=urn:btih:93014BF4D458EC39A16C7D3615E3CFBAE42144CC&dn=Winged+Migration+%282001%29+720p+BluRay&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2F47.ip-51-68-199.eu%3A6969%2Fannounce"
# Decode the magnet link
decoded = magnet_decode(magnet_link)
# Access the decoded information
print(decoded.__dict__)
Output expected
{
'xt': 'urn:btih:93014BF4D458EC39A16C7D3615E3CFBAE42144CC',
'info_hash': '93014bf4d458ec39a16c7d3615e3cfbae42144cc',
'name': 'Winged Migration (2001) 720p BluRay',
'tr': [
'http://p4p.arenabg.com:1337/announce',
'udp://47.ip-51-68-199.eu:6969/announce',
'udp://9.rarbg.me:2780/announce',
...
],
...
}
Examples
Example 1: Basic Magnet Link
magnet_link = "magnet:?xt=urn:btih:ABC1234567890&dn=Example+File"
decoded = magnet_decode(magnet_link)
print(decoded.name) # Output: Example File
Example 2: Magnet Link with Multiple Trackers
magnet_link = "magnet:?xt=urn:btih:DEF9876543210&dn=Another+Example&tr=udp://tracker.example.com:80/announce&tr=http://tracker.example.org:80/announce"
decoded = magnet_decode(magnet_link)
print(decoded.tr) # Output: ['udp://tracker.example.com:80/announce', 'http://tracker.example.org:80/announce']
just for you to know,
this readme.md file generated with AI chatbot helps, with a few Adjustments from me, for you to getting started.
Metadata
Release files for magnet-parser 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| magnet_parser-0.1.1.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| magnet_parser-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / magnet_parser-0.1.1.tar.gz
| Download URL | magnet_parser-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc3f1d39b8bdd24119f6d4dccb50f9dad7b1dd527b79ecfac1c13fae110bca68
|
|
BLAKE2b-256 checksum How to use checksums |
b9511bf542bbbcc36732ec916a5ad9d59827edc5154c761aed510f7f2db56a4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / magnet_parser-0.1.1-py3-none-any.whl
| Download URL | magnet_parser-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6ed878312d39e69cc8981512484da51e457d80d054fc0f80be331057aa4c24b
|
|
BLAKE2b-256 checksum How to use checksums |
e5c77fa4418e2754e1c508320ab051d2530a643c8f0da197ed3687d7df6baa32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for magnet-parser 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.