HDRezka (rezka.ag) Python API
Project description
HDRezka
HDRezka (rezka.ag) Python API
from hdrezka import *
player = Search('Avatar')[1, 0].player
print(player.post.info)
print(player.get_stream().best_url)
hdrezka library
Errors
hdrezka.errors
class HDRezkaError(Exception):
"""Any HDRezka exception"""
class UnknownContentType(HDRezkaError, TypeError):
"""Invalid content type"""
class AjaxFail(HDRezkaError):
"""No success response"""
class EmptySearchPage(HDRezkaError):
"""Empty search post"""
Translators info
hdrezka.translators
class Translators:
__slots__ = ('names', 'ids', 'name_id', 'id_name')
names: tuple[str]
ids: tuple[int]
name_id: dict[str, int]
id_name: dict[int, str]
def __init__(self, name_id: dict[str, int]):
...
Stream classes
hdrezka.stream.player
PlayerType = PlayerBase | PlayerMovie | PlayerSeries
class PlayerBase:
def __init__(self, url_or_cast: Self | str):
...
class PlayerMovie(PlayerBase):
def get_stream(self, translator_id: SupportsInt = None) -> URLs:
...
class PlayerSeries(PlayerBase):
def get_episodes(self, translator_id: SupportsInt = None) -> defaultdict[int, tuple[int]]:
...
def get_stream(self, season: int, episode: int, translator_id: SupportsInt = None) -> URLs:
...
def player(url_or_path: str) -> PlayerType:
"""
Returns either Player Series if series, or PlayerMovie if movie, otherwise raises UnknownContentType
"""
...
Player = player
Post classes
hdrezka.post
class Post:
"""Stores information about the post"""
__slots__ = ('url', 'translator_id', 'id', 'name', 'type', 'info', 'translators', 'other_parts_urls')
def __init__(self, url: str):
...
hdrezka.post.urls
def short_url(url: str) -> str:
"""
>>> short_url('https://rezka.ag/.../.../90909-any-name.html/')
'.../.../90909-90909'
>>> short_url('https://rezka.ag/.../.../any-name.html')
'.../.../any-name'
"""
...
def long_url(url: str) -> str:
"""
>>> long_url('rezka.ag/.../.../99999-any-name')
'https://rezka.ag/.../.../99999-99999.html'
>>> long_url('.../.../99999-99999')
'https://rezka.ag/.../.../99999-99999.html'
"""
...
class Quality(str):
addon: str # can contain 'ultra'
def __int__(self):
"""
returns pixels height
"""
...
def __lt__(self, other):
...
class URL(str):
mp4: str
class URLs:
best_url: URL
def __init__(self, data: str | dict):
...
def __getitem__(self, item: (SupportsInt | str) | (slice | Iterable)):
...
Post Info classes
hdrezka.post.info
class PostInfo:
FILL_FIELDS = ('rating', 'places', 'slogan', 'release', 'country', 'director', 'genre',
'quality', 'translator', 'age_rating', 'duration', 'from_', 'characters')
__slots__ = FILL_FIELDS + ('fields', 'title', 'orig_title', 'poster', 'description')
translator: str
def __init__(self, soup: BeautifulSoup):
...
hdrezka.post.fields
@dataclass(frozen=True)
class Rating:
service: str
rating: int | float
votes: int
@dataclass(frozen=True)
class Place:
name: str
place: int
@dataclass(frozen=True)
class Release:
year: int
day: str
@dataclass(frozen=True)
class AgeRating:
age: int
description: str
@dataclass(frozen=True)
class Duration:
number: int
units: str
class Poster(NamedTuple):
full: str
preview: str
CHANGELOG
0.0.2
- Initial version
1.0.0
Backward incompatible changes have been made
-
ReadMe updated
-
bs4 now selects lxml (if it available) once at startup
-
stream
- Hint typing fixes
Player
now caching
-
New submodule
post
,post.info
,post.info.fields
-
urls
submodule now ispost.urls
-
post
- class
Post
created
- class
-
post.urls
short_url
andlong_url
functions added (caching)short_url
,long_url
,Quality
,URL
now in__all__
-
post.info
- class
PostInfo
created
- class
-
post.info.fields
- classes
Rating
,Place
,Release
,AgeRating
,Duration
,Poster
created
- classes
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
HDRezka-1.0.0.tar.gz
(12.1 kB
view hashes)
Built Distribution
HDRezka-1.0.0-py3-none-any.whl
(14.8 kB
view hashes)