Name | magnet-parser JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | A module for decoding and encoding magnet URIs. |
upload_time | 2024-10-30 18:16:23 |
maintainer | None |
docs_url | None |
author | Muhammad Al Fajri |
requires_python | None |
license | None |
keywords |
magnet
parser
uri
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Magnet Parser
A Python library for parsing magnet links and extracting their components, designed to simplify interactions with torrent files.
## Table of Contents
- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Features](#features)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)
## 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:
```bash
pip install magnet-parser
```
```python
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
```json
{
'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
```python
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
```python
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.
Raw data
{
"_id": null,
"home_page": null,
"name": "magnet-parser",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "magnet, parser, URI",
"author": "Muhammad Al Fajri",
"author_email": "Muhammad Al Fajri <admin@pyjri.com>",
"download_url": "https://files.pythonhosted.org/packages/b9/51/1bf542bbbcc36732ec916a5ad9d59827edc5154c761aed510f7f2db56a4e/magnet_parser-0.1.1.tar.gz",
"platform": null,
"description": "# Magnet Parser\n\nA Python library for parsing magnet links and extracting their components, designed to simplify interactions with torrent files.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Examples](#examples)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n\n## Introduction\n\nThe 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.\n\n## Installation\n\nTo install the `magnet_parser` library, you can use pip:\n\n```bash\npip install magnet-parser\n```\n\n```python\nfrom magnet_parser import *\n\n# Example magnet link\nmagnet_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\"\n\n# Decode the magnet link\ndecoded = magnet_decode(magnet_link)\n\n# Access the decoded information\nprint(decoded.__dict__)\n```\n> Output expected\n```json\n{\n 'xt': 'urn:btih:93014BF4D458EC39A16C7D3615E3CFBAE42144CC',\n 'info_hash': '93014bf4d458ec39a16c7d3615e3cfbae42144cc',\n 'name': 'Winged Migration (2001) 720p BluRay',\n 'tr': [\n 'http://p4p.arenabg.com:1337/announce',\n 'udp://47.ip-51-68-199.eu:6969/announce',\n 'udp://9.rarbg.me:2780/announce',\n ...\n ],\n ...\n}\n```\n\n### Examples\n#### Example 1: Basic Magnet Link\n```python\nmagnet_link = \"magnet:?xt=urn:btih:ABC1234567890&dn=Example+File\"\ndecoded = magnet_decode(magnet_link)\nprint(decoded.name) # Output: Example File\n```\n#### Example 2: Magnet Link with Multiple Trackers\n```python\nmagnet_link = \"magnet:?xt=urn:btih:DEF9876543210&dn=Another+Example&tr=udp://tracker.example.com:80/announce&tr=http://tracker.example.org:80/announce\"\ndecoded = magnet_decode(magnet_link)\nprint(decoded.tr) # Output: ['udp://tracker.example.com:80/announce', 'http://tracker.example.org:80/announce']\n```\n\n## just for you to know,\n\nthis readme.md file generated with AI chatbot helps, with a few Adjustments from me, for you to getting started.\n",
"bugtrack_url": null,
"license": null,
"summary": "A module for decoding and encoding magnet URIs.",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"magnet",
" parser",
" uri"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e5c77fa4418e2754e1c508320ab051d2530a643c8f0da197ed3687d7df6baa32",
"md5": "d28529b7d60d4e98d0a234ccfc25486b",
"sha256": "f6ed878312d39e69cc8981512484da51e457d80d054fc0f80be331057aa4c24b"
},
"downloads": -1,
"filename": "magnet_parser-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d28529b7d60d4e98d0a234ccfc25486b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4693,
"upload_time": "2024-10-30T18:16:21",
"upload_time_iso_8601": "2024-10-30T18:16:21.298767Z",
"url": "https://files.pythonhosted.org/packages/e5/c7/7fa4418e2754e1c508320ab051d2530a643c8f0da197ed3687d7df6baa32/magnet_parser-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b9511bf542bbbcc36732ec916a5ad9d59827edc5154c761aed510f7f2db56a4e",
"md5": "12e52174e3d711f3efc636bca04b3ad1",
"sha256": "bc3f1d39b8bdd24119f6d4dccb50f9dad7b1dd527b79ecfac1c13fae110bca68"
},
"downloads": -1,
"filename": "magnet_parser-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "12e52174e3d711f3efc636bca04b3ad1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4440,
"upload_time": "2024-10-30T18:16:23",
"upload_time_iso_8601": "2024-10-30T18:16:23.223410Z",
"url": "https://files.pythonhosted.org/packages/b9/51/1bf542bbbcc36732ec916a5ad9d59827edc5154c761aed510f7f2db56a4e/magnet_parser-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 18:16:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "magnet-parser"
}