SuperZombi / HdRezkaApi

https://pypi.org/project/HdRezkaApi/
78 stars 10 forks source link

AttributeError: 'bool' object has no attribute 'replace' when rezka.getStream(1, 5) #9

Open barl0g opened 5 months ago

barl0g commented 5 months ago

File

$ cat test1.py
from HdRezkaApi import *

url = "https://hdrezkaXXXX.org/series/comedy/1733-druzya-1994.html"

rezka = HdRezkaApi(url)
print(rezka.name)
stream = rezka.getStream(1, 5)

Exec

$ python test1.py 
Друзья
Traceback (most recent call last):
  File "/home/user/www/hdrezka/test1.py", line 7, in <module>
    stream = rezka.getStream(1, 5)
  File "/home/user/miniconda3/lib/python3.10/site-packages/HdRezkaApi/__init__.py", line 231, in getStream
    return getStreamSeries(self, int(season), int(episode), tr_id)
  File "/home/user/miniconda3/lib/python3.10/site-packages/HdRezkaApi/__init__.py", line 198, in getStreamSeries
    return makeRequest({
  File "/home/user/miniconda3/lib/python3.10/site-packages/HdRezkaApi/__init__.py", line 173, in makeRequest
    arr = self.clearTrash(r['url']).split(",")
  File "/home/user/miniconda3/lib/python3.10/site-packages/HdRezkaApi/__init__.py", line 105, in clearTrash
    arr = data.replace("#h", "").split("//_//")
AttributeError: 'bool' object has no attribute 'replace'

Debug

> /home/user/miniconda3/lib/python3.10/site-packages/HdRezkaApi/__init__.py(172)makeRequest()                                
    170                         r = requests.post(f"{self.origin}/ajax/get_cdn_series/", data=data, headers=self.HEADERS, proxies=self.proxy)
    171                         r = r.json()
--> 172                         if r['success']:
    173                                 arr = self.clearTrash(r['url']).split(",")
    174                                 stream = HdRezkaStream( season=season, episode=episode,

ipdb> print(r)
{'success': True, 'message': '', 'premium_content': 0, 'url': False, 'quality': False, 'subtitle': False, 'subtitle_lns': False, 'subtitle_def': False, 'thumbnails': False}
ipdb> data
{'id': '1733', 'translator_id': 84, 'season': 1, 'episode': 5, 'action': 'get_stream'}
barl0g commented 5 months ago

Это, видимо, из-за "К сожалению, это видео не доступно в вашем регионе". Через прокси всё работает. Можно закрывать.

SuperZombi commented 5 months ago

The solution: Use a VPN