Package to download from ncore.pro
Project description
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__().
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ncoreparser-4.5.3.tar.gz.
File metadata
- Download URL: ncoreparser-4.5.3.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54d68cf098d6d14f443c838a023fadc3301a7da0cc0cace11e7f5703b7d6b1ef
|
|
| MD5 |
33733e9378da945400952c261cfb1efa
|
|
| BLAKE2b-256 |
5050f2eda30096ea1119b898b2ef8f8c8c235a62dce478816f8da057ed5b1320
|
File details
Details for the file ncoreparser-4.5.3-py3-none-any.whl.
File metadata
- Download URL: ncoreparser-4.5.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e66346a347c8e68bf4e559864ecfcee068eeaf5a2f4d97c666194dd7fc1be4e8
|
|
| MD5 |
89272356a9b3d7114455ebad047a9345
|
|
| BLAKE2b-256 |
9edc889b3496363ad24f885a9d29d66efb89ae09ded1ed407eb33524fdc6805e
|