This commit is contained in:
yasir 2023-01-17 17:14:21 +07:00
parent 0328a370b3
commit 2280700563

View file

@ -3,6 +3,7 @@ import random
import string import string
import time import time
import json import json
import logging
from http.cookies import SimpleCookie from http.cookies import SimpleCookie
from urllib.parse import urlparse from urllib.parse import urlparse
@ -13,6 +14,8 @@ from misskaty.helper.http import http
from misskaty.helper.human_read import get_readable_time from misskaty.helper.human_read import get_readable_time
from misskaty.plugins import ALL_MODULES from misskaty.plugins import ALL_MODULES
LOGGER = logging.getLogger(__name__)
GENRES_EMOJI = { GENRES_EMOJI = {
"Action": "👊", "Action": "👊",
"Adventure": random.choice(["🪂", "🧗‍♀", "🌋"]), "Adventure": random.choice(["🪂", "🧗‍♀", "🌋"]),
@ -98,10 +101,11 @@ def get_provider(url):
async def search_jw(movie_name: str, locale: str): async def search_jw(movie_name: str, locale: str):
m_t_ = "" m_t_ = ""
response = await http.get(f"https://justwatch.imdbot.workers.dev/?q={movie_name}&L={locale}".format( try:
q=movie_name, response = await http.get(f"https://yasirapi.eu.org/justwatch?q={movie_name}&locale={locale}")
L=locale except Exception as err:
)) LOGGER.error("JustWatch API Error or got Rate Limited.")
return m_t_
soup = json.loads(response.text) soup = json.loads(response.text)
items = soup["items"] items = soup["items"]
for item in items: for item in items: