Skip to content

Commit

Permalink
[IMDB Search] Changed Code With Justwatch GraphQL Since Old Public Pr…
Browse files Browse the repository at this point in the history
…oxy Has Dead

Signed-off-by: Yasir Aris M <[email protected]>
  • Loading branch information
yasirarism authored Oct 27, 2023
1 parent 0cdcef3 commit 2a4d907
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions misskaty/helper/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time
from http.cookies import SimpleCookie
from re import match as re_match
from typing import Union
from urllib.parse import urlparse

import psutil
Expand Down Expand Up @@ -137,17 +138,16 @@ async def search_jw(movie_name: str, locale: str):
if not response.get("results"):
LOGGER.error("JustWatch API Error or got Rate Limited.")
return m_t_
for item in response.get("results")["items"]:
if movie_name == item.get("title", ""):
offers = item.get("offers", [])
t_m_ = []
for offer in offers:
url = offer.get("urls").get("standard_web")
if url not in t_m_:
p_o = get_provider(url)
m_t_ += f"<a href='{url}'>{p_o}</a> | "
t_m_.append(url)
if m_t_ != "":
m_t_ = m_t_[:-2].strip()
break
for item in response["results"]["data"]["popularTitles"]["edges"]:
if item["node"]["content"]["title"] == movie_name:
t_m_ = []
for offer in item["node"].get("offers", []):
url = offer["standardWebURL"]
if url not in t_m_:
p_o = get_provider(url)
m_t_ += f"<a href='{url}'>{p_o}</a> | "
t_m_.append(url)
if m_t_ != "":
m_t_ = m_t_[:-2].strip()
break
return m_t_

0 comments on commit 2a4d907

Please sign in to comment.