NIKDISSV-Forever / HDRezka

HDRezka (rezka.ag) Python API
MIT License
10 stars 0 forks source link

Script receives 500 Server Error on fn long_url #6

Closed Gokujo closed 8 months ago

Gokujo commented 8 months ago

.venv/Lib/site-packages/hdrezka/post/post.py:18 Just commented this line and 200 answer received from rezka

I am using Python 3.9 on Win 11

Gokujo commented 8 months ago

No problem on python 3.11

NIKDISSV-Forever commented 8 months ago

I recommend updating python to version >=3.10 and installing the latest version of the package.


If there is no such possibility:

The hdrezka API has undergone some changes, but you can manually make changes to version 1.1.1 (the latest version supporting python 3.9) if necessary. In the hdrezka/post/urls.py file:

Line 12:

_match_quality_int = re.compile(r'(\d+)[pi]\s*($|\w+)').match

Replace with:

_match_quality_int = re.compile(r'(\d+)([piK])\s*($|\w+)').match

see this update.

Function Content

def short_url(url: str) -> str:

and

def long_url(url: str) -> str:

Replace with:

    return url

see https://github.com/NIKDISSV-Forever/HDRezka/issues/4

And (line 46)

        _i, self.addon = _i.groups()

Replace with:

        _i, u, self.addon = _i.groups()
        if u == 'K':
            _i += '000'

Note https://github.com/NIKDISSV-Forever/HDRezka/issues/5: if what you are going to play the video through does not support redirection, you will need to manually process the 301/302 codes