Skip to content

Commit

Permalink
few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgojoof6eyes committed Dec 29, 2024
1 parent 2a369bf commit e3fb988
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions Powers/plugins/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ async def forward_type_broadcast(c: Gojo, m: Message):
• /neofetch : Fetch neo.
• /eval : Evaluate the given python code.
• /exec : Execute the given code.
• /minfo [module name]: Give info about module
• /chatlist : Return the list of chats present in database
• /uptime : Return the uptime of the bot.
• /leavechat : Bot will leave the provided chat.
Expand Down
9 changes: 4 additions & 5 deletions Powers/plugins/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,11 @@ async def info_func(c: Gojo, message: Message):
return
try:
user, _, user_name = await extract_user(c, message)
except Exception:
await message.reply_text("Got Some errors failed to fetch user info")
except Exception as e:
await message.reply_text(f"Got Some errors failed to fetch user info\n{e}")
LOGGER.error(e)
LOGGER.error(format_exc)
if not user:
await message.reply_text("Can't find user to fetch info!")
LOGGER.error(format_exc())
return

m = await message.reply_text(
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
Expand Down
23 changes: 19 additions & 4 deletions Powers/utils/web_scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def get_videos(self) -> list:

# else:
# return {}

timeout = httpx.Timeout(20)
curr_timeout = 20
timeout = httpx.Timeout(curr_timeout)

class INSTAGRAM:
def __init__(self, url):
Expand All @@ -220,12 +220,27 @@ def is_correct_url(self):
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))

def get_media(self):
global curr_timeout
try:
return httpx.post(
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
timeout=timeout
).json()
except httpx.ReadTimeout:
return self.get_media(self.url)
try:
curr_timeout += 10
timeout = httpx.Timeout(curr_timeout)
return httpx.post(
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
timeout=timeout
).json()
except httpx.ReadTimeout:
return {"code": 69, "message": "Please retry after few seconds"}
except Exception as e:
LOGGER.error(e)
LOGGER.error(format_exc())
return {"code": 69, "message": e}

except Exception as e:
LOGGER.error(e)
LOGGER.error(format_exc())
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ charset-normalizer==3.4.0
dnspython==2.6.1
google==3.0.0
gpytranslate==1.5.1
httpx
httpx==0.27.2
lyricsgenius==3.0.1
pillow == 10.3.0
lottie==0.7.1
Expand All @@ -18,7 +18,7 @@ pillow == 10.3.0
prettyconf==2.2.1
pyaes==1.6.1
pymongo==4.6.3
git+https://github.com/KurimuzonAkuma/[email protected].32
git+https://github.com/KurimuzonAkuma/[email protected].34
pysocks==1.7.1
python-dateutil==2.8.2
pytube==15.0.0
Expand Down

0 comments on commit e3fb988

Please sign in to comment.