From 2a4d9070afe52a287415262820ed1c59af3a901e Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Fri, 27 Oct 2023 10:10:32 +0700 Subject: [PATCH 1/3] [IMDB Search] Changed Code With Justwatch GraphQL Since Old Public Proxy Has Dead Signed-off-by: Yasir Aris M --- misskaty/helper/tools.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/misskaty/helper/tools.py b/misskaty/helper/tools.py index 4dd471c1..4bfddc40 100644 --- a/misskaty/helper/tools.py +++ b/misskaty/helper/tools.py @@ -5,6 +5,7 @@ import string 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 @@ -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"{p_o} | " - 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"{p_o} | " + t_m_.append(url) + if m_t_ != "": + m_t_ = m_t_[:-2].strip() + break return m_t_ From 0824a476b3c0a123eb657093d2895e4c0f154982 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Fri, 27 Oct 2023 10:11:34 +0700 Subject: [PATCH 2/3] Optional param Signed-off-by: Yasir Aris M --- misskaty/helper/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misskaty/helper/tools.py b/misskaty/helper/tools.py index 4bfddc40..6f6fc2b8 100644 --- a/misskaty/helper/tools.py +++ b/misskaty/helper/tools.py @@ -125,7 +125,7 @@ def get_provider(url): return pretty(netloc.split(".")) -async def search_jw(movie_name: str, locale: str): +async def search_jw(movie_name: str, locale: Union[str, None] = "ID"): m_t_ = "" try: response = ( From 3e3cca2750b266f178899978dd50623ad3325c3e Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Sat, 28 Oct 2023 21:22:22 +0700 Subject: [PATCH 3/3] Fixed lock all Signed-off-by: Yasir Aris M --- misskaty/plugins/locks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misskaty/plugins/locks.py b/misskaty/plugins/locks.py index 664382b1..e4356778 100644 --- a/misskaty/plugins/locks.py +++ b/misskaty/plugins/locks.py @@ -165,7 +165,7 @@ async def locks_func(_, message): await tg_lock(message, permissions, data[parameter], state == "lock") elif parameter == "all" and state == "lock": try: - await app.set_chat_permissions(chat_id, ChatPermissions(all_perms=True)) + await app.set_chat_permissions(chat_id, ChatPermissions(all_perms=False)) await message.reply_text(f"Locked Everything in {message.chat.title}") except ChatAdminRequired: await message.reply_msg(