mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-01 02:24:52 +00:00
Fix
This commit is contained in:
parent
fccae5731d
commit
8fb2588d0c
2 changed files with 5 additions and 7 deletions
|
|
@ -3,7 +3,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
import chevron
|
||||
import telegraph
|
||||
from .media_helper import post_to_telegraph
|
||||
import logging
|
||||
from aiohttp import ClientSession
|
||||
from misskaty import BOT_USERNAME
|
||||
|
|
@ -11,11 +11,6 @@ from bs4 import BeautifulSoup as bs4
|
|||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
telegraph = telegraph.Telegraph()
|
||||
if telegraph.get_access_token() == None:
|
||||
token_ph = telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info(f"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"}
|
||||
|
||||
|
||||
|
|
@ -84,7 +79,7 @@ async def byPassPh(url: str, msg_id: int):
|
|||
""".strip()
|
||||
if not kusonime["error"]:
|
||||
html = chevron.render(template, kusonime)
|
||||
page = telegraph.create_page(f"{kusonime.get('title')}-{msg_id}", html_content=html)
|
||||
page = await post_to_telegraph(False, f"{kusonime.get('title')}-{msg_id}", html)
|
||||
results.update({"error": False, "url": "https://telegra.ph/{}".format(page["path"])})
|
||||
del results["error_message"]
|
||||
return results
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ from utils import LOGGER
|
|||
|
||||
async def post_to_telegraph(is_media: bool, title=None, content=None, media=None):
|
||||
telegraph = Telegraph()
|
||||
if telegraph.get_access_token() == None:
|
||||
await telegraph.create_account(short_name=BOT_USERNAME)
|
||||
LOGGER.info(f"Create TGH Account ..")
|
||||
if is_media:
|
||||
"""Create a Telegram Post Foto/Video"""
|
||||
response = await telegraph.upload_file(media)
|
||||
|
|
|
|||
Loading…
Reference in a new issue