[32] fix imdb_watchlist

This commit is contained in:
meisnate12 2024-02-28 15:40:34 -05:00
parent 428dbe6ba2
commit c75e017009
2 changed files with 5 additions and 4 deletions

View file

@ -1 +1 @@
1.20.0-develop31
1.20.0-develop32

View file

@ -189,9 +189,10 @@ class IMDb:
def _watchlist(self, user, language):
imdb_url = f"{base_url}/user/{user}/watchlist"
group = self._request(imdb_url, language=language, xpath="//span[@class='ab_widget']/script[@type='text/javascript']/text()")
if group:
return [k for k in json.loads(str(group[0]).split("\n")[5][35:-2])["titles"]]
for text in self._request(imdb_url, language=language , xpath="//div[@class='article']/script/text()")[0].split("\n"):
if text.strip().startswith("IMDbReactInitialState.push"):
jsonline = text.strip()
return [f for f in json.loads(jsonline[jsonline.find('{'):-2])["starbars"]]
raise Failed(f"IMDb Error: Failed to parse URL: {imdb_url}")
def _total(self, imdb_url, language):