Update socialbot.py

This commit is contained in:
Ryuk 2023-02-04 19:56:39 +05:30 committed by GitHub
parent 1e86016bd0
commit 09262818a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,7 +221,7 @@ async def dl(bot, message: Message):
async def iyt_dl(url: str):
"""Stop post url handling because this only downloads Videos and post might contain images"""
"""Stop handling post url because this only downloads Videos and post might contain images"""
if url.startswith("https://www.instagram.com/p/"):
return "failed"
path_ = time.time()
@ -256,13 +256,11 @@ async def iyt_dl(url: str):
async def json_dl(iurl: str, doc: bool, caption: str):
link = iurl.split("/?")[0] + e_json
async with aiohttp.ClientSession() as session:
async with (aiohttp.ClientSession() as csession, csession.get(link, timeout=10) as session):
try:
async with session.get(link, timeout=10) as session:
session_resp = await session.text()
rjson = json.loads(session_resp)
except Exception as e:
print(e)
except json.decoder.JSONDecodeError:
return "failed"
if "require_login" in rjson:
return "failed"