HDRezka Python API
Project description
HDRezka site API
Install
pip install HDRezka
Example
import asyncio
import os
from hdrezka import Search
from hdrezka.api.http import login_global
async def main():
await login_global(os.environ['LOGIN_NAME'], os.environ['LOGIN_PASSWORD'])
player = await (await Search('Breaking Bad').get_page(1))[0].player
# or use url (await Player('series/thriller/646-vo-vse-tyazhkie-2008.html'))
print(player.post.info, end='\n\n')
translator_id = None # default
for name, id_ in player.post.translators.name_id.items():
if 'субтитры' in name.casefold(): translator_id = id_; break
stream = await player.get_stream(1, 1, translator_id, ) # raise AJAXFail if invalid episode or translator
video = stream.video
print(await video.last_url[-1]) # best quality (.m3u8) (last source)
# source - is not a finished link, await will return the link after the redirect
print(await video[video.min].last_url[0].mp4, end='\n\n') # worst quality (.mp4) (first source)
subtitles = stream.subtitles
print(subtitles.default.url) # subtitles.ru.url or subtitles['Русский'].url
if __name__ == '__main__': asyncio.run(main())
Bypass Blocking
Custom HOST
from hdrezka.url import Request
Request.HOST = 'https://hdrezka.club/'
If the specified domain is protected by Cloudflare, successful response retrieval from the server cannot be guaranteed and may be inconsistent. See this file.
Proxies
pip install hdrezka[socks]
tor
import httpx
import hdrezka.api.http
hdrezka.api.http.DEFAULT_CLIENT = httpx.AsyncClient(
headers={'User-Agent': 'Mozilla/5.0'},
proxy='socks5://localhost:9050'
)
Log In (recommended for now)
Create an account on HDRezka.
If registration is temporarily disabled, try logging in via social media and resetting your password (so that you have one completely).
Call hdrezka.api.http.login_global - this function will send a request to hdrezka.api.http.Request.REDIRECT_URL,
which will redirect to an active mirror. The function will then store the retrieved mirror globally in Request.HOST
and save the cookies in hdrezka.api.http.DEFAULT_CLIENT.
import os
from hdrezka.api.http import login_global
async def main():
await login_global(os.environ['LOGIN_NAME'], os.environ['LOGIN_PASSWORD'])
This method will also help if HDRezka considers your IP suspicious, suggests changing your VPN (proxy), and returns a 403 error.
Documentation
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 hdrezka-4.0.3.tar.gz.
File metadata
- Download URL: hdrezka-4.0.3.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae8dda4f146ca77527ae943fd3d915bea7936281bff77cf568802c42d3cb826d
|
|
| MD5 |
3462da19c591184c9e069e1485cd827c
|
|
| BLAKE2b-256 |
4e15fb68087bd5440d7598609939708550da6cce9ede56c3f4ea29b731d61b73
|
File details
Details for the file hdrezka-4.0.3-py3-none-any.whl.
File metadata
- Download URL: hdrezka-4.0.3-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24e71183861940b0d8ae229d7d1e990aa0cfb29e4d3b38616861dd08ff2063d8
|
|
| MD5 |
bfdf30aa349302e2722e59700a1f1e27
|
|
| BLAKE2b-256 |
8ac41c9ac6dcdf3f34e1bf64cf36865a67cb23b6b52bb7a766b225cbf08b4d91
|