HdRezkaApi
Install:
pip install HdRezkaApi
Table of Contents:
- Usage
- Film Information
- Translators priority
- getStream
- getSeasonStreams
- HdRezkaStream
- HdRezkaStreamSubtitles
- HdRezkaRating
- Proxy
- Cookies
- HdRezkaSearch
- HdRezkaSession
Usage
from HdRezkaApi import HdRezkaApi
from HdRezkaApi.types import TVSeries, Movie
from HdRezkaApi.types import Film, Series, Cartoon, Anime
url = "https://hdrezka.ag/ __YOUR_URL__ .html"
rezka = HdRezkaApi(url)
if not rezka.ok:
print("Error:", str(rezka.exception))
raise rezka.exception
print(rezka.name)
print(rezka.thumbnail)
print( rezka.rating.value )
print( rezka.rating.votes )
print( rezka.translators )
print( rezka.otherParts )
print( rezka.seriesInfo )
print(rezka.type)
print(rezka.type == TVSeries == TVSeries() == "tv_series")
print(rezka.category)
print(rezka.category == Anime == Anime() == "anime")
print( rezka.getStream()('720p') ) # if movie
print( rezka.getStream('1', '1')('720p') )
print( dict(rezka.getSeasonStreams('1')) )
Film Information
| Attribute | Description |
|---|---|
self.id |
Film ID |
self.name |
Film name |
self.description |
Film description |
self.type |
HdRezkaFormat |
self.category |
HdRezkaCategory |
self.thumbnail |
Film thumbnail URL |
self.thumbnailHQ |
Film thumbnail in high quality |
self.rating |
HdRezkaRating |
self.otherParts |
Other parts of this film [{Film_name: url}] |
self.translators |
Translators dict by id |
self.translators_names |
Translators dict by names |
self.seriesInfo |
Series info by translators |
self.episodesInfo |
All seasons and episodes |
translators
{
Translator_id: {
name: Translator_name,
premium: bool
}
}
translators_names
{
Translator_name: {
id: Translator_id,
premium: bool
}
}
seriesInfo
{
Translator_id: {
translator_name,
seasons: {1, 2},
episodes: {
1: {1, 2, 3},
2: {1, 2, 3}
}
}
}
episodesInfo
[
{
season: 1, season_text,
episodes: [
{
episode: 1, episode_text,
translations: [
{translator_id, translator_name, premium}
]
}
]
}
]
HdRezkaFormat
Parent of classes: TVSeries and Movie
from HdRezkaApi.types import TVSeries, Movie
rezka.type == TVSeries == TVSeries() == "tv_series"
HdRezkaCategory
Parent of classes: Film, Series, Cartoon, Anime
from HdRezkaApi.types import Film, Series, Cartoon, Anime
rezka.category == Anime == Anime() == "anime"
Translators priority
rezka = HdRezkaApi(url, translators_priority:list, translators_non_priority:list)
# or
rezka.translators_priority = new_value
rezka.translators_non_priority = new_value
translators_priority
Priority of translators IDs, where the further to the left, the more desirable the translation.
translators_non_priority
Priority of unwanted translator identifiers, where the further to the right, the less desirable the translation.
sort_translators
sort_translators(
translators=self.translators,
priority=self.translators_priority,
non_priority=self.translators_non_priority
)
getStream
getStream(season, episode, translation=None, priority=None, non_priority=None)
getStream(
translation='Дубляж' or translation='56'
)
If type is movie then there is no need to specify season and episode.
stream = rezka.getStream() # if movie
priority and non_priority
getSeasonStreams
getSeasonStreams(season, translation=None, ignore=False, progress=None, priority=None, non_priority=None)
getSeasonStreams(
translation='Дубляж' or translation='56'
)
priority and non_priority
ignore - ignore errors
progress - callback function
def progress(current, all):
percent = round(current * 100 / all)
print(f"{percent}%: {current}/{all}", end="\r")
print( dict(rezka.getSeasonStreams(1, ignore=True, progress=progress)) )
Output example:
{'1': <HdRezkaStream(season:1, episode:1)>, '2': <HdRezkaStream(season:1, episode:2)>, ...}
If an error occurs, an attempt will be made to repeat the request again.
But if the error occurs again, then None will be added to the final dict.
To ignore errors and retry requests until a response is received, specify the ignore=True option.
for i, stream in rezka.getSeasonStreams('1'):
print(stream)
HdRezkaStream
| Attribute | Description |
|---|---|
self.videos |
Dict of videos where the key is resolution and value is list of URLs |
self.name |
Film name |
self.translator_id |
Translator ID |
self.season |
Season number (None if film) |
self.episode |
Episode number (None if film) |
self.subtitles |
HdRezkaStreamSubtitles object |
HdRezkaStream(resolution) |
Call object with argument to get the URL of the video |
Usage examples:
stream = rezka.getStream(1, 5)
print( stream('720p') )
print( stream('720') )
print( stream(1080) )
print( stream('Ultra') )
print( stream('1080p Ultra') )
print( stream.videos )
{
'360p': ['https://sambray.org/...mp4', 'https://stream.voidboost.cc/...mp4'],
'480p': ['https://sambray.org/...mp4', 'https://stream.voidboost.cc/...mp4'],
'720p': ['https://sambray.org/...mp4', 'https://stream.voidboost.cc/...mp4'],
}
HdRezkaStreamSubtitles
| Attribute | Description |
|---|---|
self.subtitles |
Dict of subtitles where the key is the language code and value is the subtitle information |
self.keys |
List of available subtitle language codes |
self(id) |
Call object with argument to get URL of subtitles |
Usage examples:
stream = rezka.getStream(1, 5)
print( stream.subtitles.subtitles ) # { 'en': {'title': 'English', 'link': 'https:/'}, ... }
print( stream.subtitles.keys ) # ['en', 'ru']
print( stream.subtitles('en') ) # 'https:/'
print( stream.subtitles('English') ) # 'https:/'
print( stream.subtitles(0) ) # 'https:/'
# ^ index
HdRezkaRating
| Attribute | Description |
|---|---|
self.value |
Rating value (float) |
self.votes |
Number of votes (int) |
Proxy
rezka = HdRezkaApi(url, proxy={'http': 'http://192.168.0.1:80'})
Cookies
rezka = HdRezkaApi(url, cookies={"dle_user_id": user_id, "dle_password": password_hash})
If you are not sure:
rezka = HdRezkaApi(url, cookies=HdRezkaApi.make_cookies(user_id, password_hash))
Manually login:
rezka = HdRezkaApi(url)
rezka.login("your_email@gmail.com", "your_password1234")
HdRezkaSearch
HdRezkaSearch(origin, proxy, headers, cookies)(query, find_all=False)
Fast search
from HdRezkaApi.search import HdRezkaSearch
results = HdRezkaSearch("https://hdrezka.ag/")("film name")
[
{
'title': 'Film name',
'url': 'https://hdrezka.ag/__FILM_URL.html',
'rating': 7.8
}
]
Advanced search
from HdRezkaApi.search import HdRezkaSearch
results = HdRezkaSearch("https://hdrezka.ag/", cookies)("film name", find_all=True)
for page in results:
for result in page:
print(result)
{
'title': 'Film name',
'url': 'https://hdrezka.ag/__FILM_URL.html',
'image': 'https://hdrezka.ag/image.jpg',
'category': HdRezkaCategory()
}
HdRezkaCategory
Series, Film, Cartoon, Anime.
All pages
print(results.all_pages)
[
[ {'title', 'url', 'image', 'category'}, ...],
[ {'title', 'url', 'image', 'category'}, ...],
...
]
Flatten results
print(results.all)
[
{'title', 'url', 'image', 'category'},
{'title', 'url', 'image', 'category'},
...
]
Specific page
print(results.get_page(2)) # page number
# or
print(results[1]) # index
HdRezkaSession
HdRezkaSession allows you to log in once and not send login requests every time.
You can also specify origin to make requests to a same site. Origin in full urls will be ignored.
In the next example, the request will be made to the url: "https://rezka_mirror.com/__YOUR_URL__.html"
from HdRezkaApi import HdRezkaSession
with HdRezkaSession("https://rezka_mirror.com/") as session:
session.login("email@gmail.com", "password")
rezka = session.get("https://hdrezka.ag/__URL_PATH__.html")
Also when specifying origin you can specify only url path.
with HdRezkaSession("https://rezka_mirror.com/") as session:
rezka = session.get("__URL_PATH__.html")
You can also not specify origin and then requests will be made to the URL you specified.
But then you won't be able to use login().
with HdRezkaSession() as session:
rezka = session.get("https://hdrezka.ag/__URL_PATH__.html")
with HdRezkaSession(cookies=cookies, headers=headers, proxy=proxy) as session:
# or inline seting up
session.cookies = cookies
session.headers = headers
session.proxy = proxy
translators_priority
with HdRezkaSession(translators_priority, translators_non_priority) as session:
# or inline seting up
session.translators_priority = new_value
session.translators_non_priority = new_value
Searching with session
Fast search
with HdRezkaSession("https://rezka_mirror.com/") as session:
results = session.search("film name")
Advanced search
with HdRezkaSession("https://rezka_mirror.com/") as session:
session.login("email@gmail.com", "password")
results = session.search("film name", find_all=True)
for page in results:
for result in page:
print(result)
💲Donate
|
|
Donatello |
|
|
Donation Alerts |
Release files for HdRezkaApi 11.2.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 | |
|---|---|---|---|
| hdrezkaapi-11.2.3.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hdrezkaapi-11.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:27.3 kB
Release files / hdrezkaapi-11.2.3.tar.gz
| Download URL | hdrezkaapi-11.2.3.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cf40cfdd15597bc47810dd252275264f138721feaf1ccff3b4929505c6b964c
|
|
BLAKE2b-256 checksum How to use checksums |
97551ccf1f2156ffb6a9e4c4fac39f08204fd71ac47772a460509612e165aa61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / hdrezkaapi-11.2.3-py3-none-any.whl
| Download URL | hdrezkaapi-11.2.3-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3781a7116220d63fd1025943d297410a4eeafca2e143b421add18c593edb2466
|
|
BLAKE2b-256 checksum How to use checksums |
2c306cc8ce89f039df0fd8e010740ea98b7c5c592eb855823c12a68ba747ebd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|