Skip to main content

HDRezka (rezka.ag) Python API

Project description

HDRezka site API.

Install

pip install HDRezka

Example

import asyncio
from hdrezka import Search


async def main():
    player = await (await Search('Breaking Bad').get_page(1))[0].player
    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)  # best quality (.m3u8)
    print((await video[video.min].last_url).mp4, end='\n\n')  # worst quality (.mp4)

    subtitles = stream.subtitles
    print(subtitles.default.url)  # subtitles.ru.url or subtitles['Русский'].url


if __name__ == '__main__': asyncio.run(main())

Documentation


CHANGELOG

3.2.2

  • post.urls

    • Added supports of added support for quality in the format 2K, 4K, ...

3.2.1

  • post.kind.video

    • if await VideoURL instance, it's follow url redirects and return correct download url. See issue 5.
    • Now VideoURL.mp4 is property.
  • api.http

    • passed get_response(..., **kwargs) have more weight than DEFAULT_REQUEST_KWARGS.

3.2.0

  • Documentation and doc-strings improved.

  • Type-checking improved (None-safety checks)

  • New submodule api.types.

  • api

    • http

      • Added RequestKwargs(TypedDict) type-hint.
      • DEFAULT_CLINET_KWARGS replaced with just DEFAULT_CLIENT.
    • types

      • Added APIResponse(TypedDict) type-hint.
  • post.fields

    • Added default empty strings.
  • post.info.PostInfo

    • if age_rating rating not found, AgeRating.age sets -1.
  • post.urls.king.video.VideoURLs

    • __getitem__(self, item: str | SupportsInt | Iterable | slice) updated (see documentations).
  • stream.player

    • fixed issue 1.
    • fixed issue 4.
    • PlayerType everyplace replaced with PlayerMovie | PlayerSeries.

3.1.2

3.1.1

  • Documentation improved.

3.1.0

  • requirements.txt

    • bs4 replaced with beautifulsoup4.
    • lxml now installs on versions < 3.13 (instead of < 3.12).
  • api.http

    • Added DEFAULT_REQUEST_KWARGS.

3.0.3

  • stream.player

    • Player Caching

      • fixed RuntimeError: dictionary changed size during iteration.
      • removed sys.getsizeof (for compatibility with PyPy), used len instead.

3.0.2

  • post.urls.kind.VideoURLs

    • __init__(self, data: str | dict) now raises TypeError if data isn't of type str | dict (see this issue).

3.0.1

  • Now __await__ method (need await ... expression) instead ainit method.

3.0.0

  • Now a fully asynchronous package.

  • post.page.Page

    • Implements __aiter__ and __anext__ methods that list all the pages found.
    • Instead of get_pages, now only the get_page method.

2.0.1

  • Fixed bug with PIP.

2.0.0

Backward incompatible changes have been made.

  • New submodules urls.short, urls.kind, urls.kind.quality, urls.kind.subtitles, urls.kind.video.

  • Optimizations.

  • Ajax renamed to AJAX (PEP-8).

  • the get_stream method now contains the video attribute and the subtitle attribute.

  • urls

    • New function urls_from_ajax_response -> URLs.
  • urls.short

    • short_url, long_url.
  • urls.kind

    • class Quality now in urls.king.quality (also in __init__).
  • urls.kind.video

    • classes VideoURL, VideoURLs.
  • urls.kind.subtitle

    • classes SubtitleURL, SubtitleURLs.

1.1.3

  • internal bugfixes.

1.1.2

  • added pdoc documentation.

  • now Python 3.10 has become the minimum compatible version.

  • removed all from __future__ import annotations statements.

  • used match...case statements.

  • optimization.

  • new submodule api.http.

  • get_response moved to api.http submodule.

1.1.1

  • fixed bug with importing stream.Post.
  • fixed post.urls.url_short function.

1.1.0

  • post.urls.short_url now even shorter.

  • errors

    • EmptySearchPage replaced with EmptyPage.
  • New submodule post.page

  • post.page

    • new Page class that will parse any page rezka.ag on InlineItem (new data class).
  • api.search

    • Search now inherited from Page.

1.0.0

Backward incompatible changes have been made.

  • bs4 now selects lxml (if it available) once at startup.

  • new submodule post, post.info, post.info.fields.

  • class post.Post created.

  • class post.info.PostInfo created.

  • urls submodule now is post.urls.
  • stream

    • type-hinting fixes.
    • Player now caching.
  • post.urls

    • short_url and long_url functions added (caching).
    • short_url, long_url, Quality, URL now in __all__.
  • post.info.fields

    • classes Rating, Place, Release, AgeRating, Duration, Poster created.

0.0.2

  • initial version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HDRezka-3.2.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

HDRezka-3.2.2-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file HDRezka-3.2.2.tar.gz.

File metadata

  • Download URL: HDRezka-3.2.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for HDRezka-3.2.2.tar.gz
Algorithm Hash digest
SHA256 03c56b54857499cc564831134531e448ca82e56c6ea2babeb42888b13a409bd9
MD5 c8d5d271ced18b1affaff66853a195e5
BLAKE2b-256 1b7bee8040123ff619ca1e1349299acc7356341a768d05efe7e3a9e3e8f812f0

See more details on using hashes here.

File details

Details for the file HDRezka-3.2.2-py3-none-any.whl.

File metadata

  • Download URL: HDRezka-3.2.2-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for HDRezka-3.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd7aa8dd6491451f37552235887be3f49367ef46e735ea27b0fc9b65022e70c
MD5 cefabb747427ed9a3202d65aaed30631
BLAKE2b-256 b9c0abef7af1f61170beef385abb1a5f814418687d64f84093b4360615b90920

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page