mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 11:04:51 +00:00
Fix
This commit is contained in:
parent
56ebdfdab3
commit
4c0c14e4e8
3 changed files with 10 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import chevron
|
import chevron
|
||||||
import telegraph
|
from telegraph.aio import Telegraph
|
||||||
import logging
|
import logging
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from misskaty import BOT_USERNAME
|
from misskaty import BOT_USERNAME
|
||||||
|
|
@ -9,11 +9,6 @@ from bs4 import BeautifulSoup as bs4
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
telegraph = telegraph.Telegraph()
|
|
||||||
if telegraph.get_access_token() is None:
|
|
||||||
token_ph = telegraph.create_account(short_name=BOT_USERNAME)
|
|
||||||
LOGGER.info("kuso_utils: Create TGH Account ..")
|
|
||||||
|
|
||||||
headers = {"Accept": "*/*", "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"}
|
headers = {"Accept": "*/*", "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,7 +83,12 @@ async def byPassPh(url: str, msg_id: int):
|
||||||
{{/data}}
|
{{/data}}
|
||||||
""".strip()
|
""".strip()
|
||||||
html = chevron.render(template, kusonime)
|
html = chevron.render(template, kusonime)
|
||||||
page = telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
telegraph = Telegraph()
|
||||||
|
if telegraph.get_access_token() is None:
|
||||||
|
await telegraph.create_account(short_name=BOT_USERNAME)
|
||||||
|
LOGGER.info("Create TGH Account ..")
|
||||||
|
page = await telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
||||||
|
LOGGER.info(page)
|
||||||
results |= {"error": False, "url": f'https://telegra.ph/{page["path"]}'}
|
results |= {"error": False, "url": f'https://telegra.ph/{page["path"]}'}
|
||||||
del results["error_message"]
|
del results["error_message"]
|
||||||
return results
|
return results
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ async def imdb_id_callback(_, query):
|
||||||
res_str = ""
|
res_str = ""
|
||||||
if judul := r_json.get("name"):
|
if judul := r_json.get("name"):
|
||||||
try:
|
try:
|
||||||
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span", class_="sc-8c396aa2-2 jwaBvf").text
|
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span").text
|
||||||
except:
|
except:
|
||||||
tahun = "N/A"
|
tahun = "N/A"
|
||||||
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{judul} [{tahun}]</a> (<code>{typee}</code>)\n"
|
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{judul} [{tahun}]</a> (<code>{typee}</code>)\n"
|
||||||
|
|
@ -394,7 +394,7 @@ async def imdb_en_callback(bot, query):
|
||||||
res_str = ""
|
res_str = ""
|
||||||
if judul := r_json.get("name"):
|
if judul := r_json.get("name"):
|
||||||
try:
|
try:
|
||||||
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span", class_="sc-8c396aa2-2 jwaBvf").text
|
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span").text
|
||||||
except:
|
except:
|
||||||
tahun = "N/A"
|
tahun = "N/A"
|
||||||
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{judul} [{tahun}]</a> (<code>{typee}</code>)\n"
|
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{judul} [{tahun}]</a> (<code>{typee}</code>)\n"
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ async def imdb_inl(_, query):
|
||||||
typee = r_json.get("@type", "")
|
typee = r_json.get("@type", "")
|
||||||
if r_json.get("name"):
|
if r_json.get("name"):
|
||||||
try:
|
try:
|
||||||
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span", class_="sc-8c396aa2-2 jwaBvf").text
|
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find("span").text
|
||||||
except:
|
except:
|
||||||
tahun = "N/A"
|
tahun = "N/A"
|
||||||
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{typee}</code>)\n"
|
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{typee}</code>)\n"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue