Ncoreparser
Introduction
This module provides python API-s to manage torrents from ncore.pro eg.: search, download, rssfeed, etc..
Install
pip install ncoreparser
Examples
Search torrent
Get most seeded torrents from all category
from ncoreparser import Client, SearchParamWhere, SearchParamType, ParamSort, ParamSeq
if __name__ == "__main__":
client = Client()
cookies = client.login("<username>", "<password>")
for t_type in SearchParamType:
torrent = client.search(
pattern="",
type=t_type,
sort_by=ParamSort.SEEDERS,
sort_order=ParamSeq.DECREASING
).torrents[0]
print(torrent['title'], torrent['type'], torrent['size'], torrent['id'])
client.logout()
Cookie persistence
Save and reuse cookies to avoid re-authentication (if cookies haven't expired):
import json
import os
from ncoreparser import Client
COOKIE_FILE = "ncore_cookies.json"
saved_cookies = None
if os.path.exists(COOKIE_FILE):
with open(COOKIE_FILE, 'r') as f:
saved_cookies = json.load(f)
client = Client(cookies=saved_cookies)
if not client._logged_in:
cookies = client.login("<username>", "<password>")
with open(COOKIE_FILE, 'w') as f:
json.dump(cookies, f)
torrents = client.get_by_activity()
Download torrent
This example download Forest gump torrent file and save it to temp folder
from ncoreparser import Client, SearchParamWhere, SearchParamType, ParamSort, ParamSeq
if __name__ == "__main__":
client = Client()
cookies = client.login("<username>", "<password>")
torrent = client.search(
pattern="Forrest gump",
type=SearchParamType.HD_HUN,
sort_by=ParamSort.SEEDERS,
sort_order=ParamSeq.DECREASING
).torrents[0]
client.download(torrent, "/tmp")
client.logout()
Download torrent by rssfeed
This example get all torrents and their informations from an ncore bookmark (rss feed)
from ncoreparser import Client
if __name__ == "__main__":
client = Client()
cookies = client.login("<username>", "<password>")
torrents = client.get_by_rss("<rss url>")
for torrent in torrents:
print(torrent['title'], torrent['type'], torrent['size'], torrent['id'])
client.logout()
Get torrents by activity
This example get all torrents and their informations from the Hit&run page
from ncoreparser import Client
if __name__ == "__main__":
client = Client()
cookies = client.login("<username>", "<password>")
torrents = client.get_by_activity()
for torrent in torrents:
print(
torrent['title'],
torrent['type'],
torrent['size'],
torrent['id'],
torrent['rate'],
torrent['remaining']
)
client.logout()
Get recommended torrents
This example get all torrents and their informations from the recommended page
from ncoreparser import Client, SearchParamType
if __name__ == "__main__":
client = Client()
cookies = client.login("<username>", "<password>")
torrents = client.get_recommended(type=SearchParamType.HD_HUN)
for torrent in torrents:
print(torrent['title'], torrent['type'], torrent['size'], torrent['id'])
client.logout()
Two-factor authentication (2FA)
If your account has 2FA enabled, provide the code as the third parameter:
from ncoreparser import Client
client = Client()
cookies = client.login("<username>", "<password>", twofactorcode="123456")
Async support
The library also supports async calls. It works same as the sync version, but you have to use the AsyncClient class.
import asyncio
from ncoreparser import AsyncClient, SearchParamWhere, SearchParamType, ParamSort, ParamSeq
async def main():
client = AsyncClient()
cookies = await client.login("<username>", "<password>")
for t_type in SearchParamType:
torrent = await client.search(
pattern="",
type=t_type,
sort_by=ParamSort.SEEDERS,
sort_order=ParamSeq.DECREASING
).torrents[0]
print(torrent['title'], torrent['type'], torrent['size'], torrent['id'])
await client.logout()
if __name__ == "__main__":
asyncio.run(main())
Note: For async clients, cookies can be passed to __init__() but validation happens on the first async operation since await cannot be called in __init__().
Metadata
Release files for ncoreparser 4.5.3
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 | Actions |
|---|---|---|---|---|
| ncoreparser-4.5.3.tar.gz | 8.7 kB | Without provenance | Details for ncoreparser-4.5.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ncoreparser-4.5.3-py3-none-any.whl | Python 3 | none | any | Details for ncoreparser-4.5.3-py3-none-any.whl |
Total release size: 21.8 kB
Release files / ncoreparser-4.5.3.tar.gz
| Download URL | ncoreparser-4.5.3.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54d68cf098d6d14f443c838a023fadc3301a7da0cc0cace11e7f5703b7d6b1ef
|
|
BLAKE2b-256 checksum How to use checksums |
5050f2eda30096ea1119b898b2ef8f8c8c235a62dce478816f8da057ed5b1320
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ncoreparser-4.5.3-py3-none-any.whl
| Download URL | ncoreparser-4.5.3-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e66346a347c8e68bf4e559864ecfcee068eeaf5a2f4d97c666194dd7fc1be4e8
|
|
BLAKE2b-256 checksum How to use checksums |
9edc889b3496363ad24f885a9d29d66efb89ae09ded1ed407eb33524fdc6805e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ncoreparser 4.5.3
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.