Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
a9917a5
1
Parent(s):
7ec9854
few fixes
Browse files- Powers/plugins/dev.py +1 -0
- Powers/plugins/info.py +4 -5
- Powers/utils/web_scrapper.py +19 -4
- requirements.txt +2 -2
Powers/plugins/dev.py
CHANGED
|
@@ -720,6 +720,7 @@ __HELP__ = """
|
|
| 720 |
• /neofetch : Fetch neo.
|
| 721 |
• /eval : Evaluate the given python code.
|
| 722 |
• /exec : Execute the given code.
|
|
|
|
| 723 |
• /chatlist : Return the list of chats present in database
|
| 724 |
• /uptime : Return the uptime of the bot.
|
| 725 |
• /leavechat : Bot will leave the provided chat.
|
|
|
|
| 720 |
• /neofetch : Fetch neo.
|
| 721 |
• /eval : Evaluate the given python code.
|
| 722 |
• /exec : Execute the given code.
|
| 723 |
+
• /minfo [module name]: Give info about module
|
| 724 |
• /chatlist : Return the list of chats present in database
|
| 725 |
• /uptime : Return the uptime of the bot.
|
| 726 |
• /leavechat : Bot will leave the provided chat.
|
Powers/plugins/info.py
CHANGED
|
@@ -241,12 +241,11 @@ async def info_func(c: Gojo, message: Message):
|
|
| 241 |
return
|
| 242 |
try:
|
| 243 |
user, _, user_name = await extract_user(c, message)
|
| 244 |
-
except Exception:
|
| 245 |
-
await message.reply_text("Got Some errors failed to fetch user info")
|
| 246 |
LOGGER.error(e)
|
| 247 |
-
LOGGER.error(format_exc)
|
| 248 |
-
|
| 249 |
-
await message.reply_text("Can't find user to fetch info!")
|
| 250 |
|
| 251 |
m = await message.reply_text(
|
| 252 |
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
|
|
|
|
| 241 |
return
|
| 242 |
try:
|
| 243 |
user, _, user_name = await extract_user(c, message)
|
| 244 |
+
except Exception as e:
|
| 245 |
+
await message.reply_text(f"Got Some errors failed to fetch user info\n{e}")
|
| 246 |
LOGGER.error(e)
|
| 247 |
+
LOGGER.error(format_exc())
|
| 248 |
+
return
|
|
|
|
| 249 |
|
| 250 |
m = await message.reply_text(
|
| 251 |
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
|
Powers/utils/web_scrapper.py
CHANGED
|
@@ -209,8 +209,8 @@ class SCRAP_DATA:
|
|
| 209 |
|
| 210 |
# else:
|
| 211 |
# return {}
|
| 212 |
-
|
| 213 |
-
timeout = httpx.Timeout(
|
| 214 |
|
| 215 |
class INSTAGRAM:
|
| 216 |
def __init__(self, url):
|
|
@@ -220,12 +220,27 @@ class INSTAGRAM:
|
|
| 220 |
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))
|
| 221 |
|
| 222 |
def get_media(self):
|
|
|
|
| 223 |
try:
|
| 224 |
return httpx.post(
|
| 225 |
-
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
|
|
|
|
| 226 |
).json()
|
| 227 |
except httpx.ReadTimeout:
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
except Exception as e:
|
| 230 |
LOGGER.error(e)
|
| 231 |
LOGGER.error(format_exc())
|
|
|
|
| 209 |
|
| 210 |
# else:
|
| 211 |
# return {}
|
| 212 |
+
curr_timeout = 20
|
| 213 |
+
timeout = httpx.Timeout(curr_timeout)
|
| 214 |
|
| 215 |
class INSTAGRAM:
|
| 216 |
def __init__(self, url):
|
|
|
|
| 220 |
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))
|
| 221 |
|
| 222 |
def get_media(self):
|
| 223 |
+
global curr_timeout
|
| 224 |
try:
|
| 225 |
return httpx.post(
|
| 226 |
+
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
|
| 227 |
+
timeout=timeout
|
| 228 |
).json()
|
| 229 |
except httpx.ReadTimeout:
|
| 230 |
+
try:
|
| 231 |
+
curr_timeout += 10
|
| 232 |
+
timeout = httpx.Timeout(curr_timeout)
|
| 233 |
+
return httpx.post(
|
| 234 |
+
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
|
| 235 |
+
timeout=timeout
|
| 236 |
+
).json()
|
| 237 |
+
except httpx.ReadTimeout:
|
| 238 |
+
return {"code": 69, "message": "Please retry after few seconds"}
|
| 239 |
+
except Exception as e:
|
| 240 |
+
LOGGER.error(e)
|
| 241 |
+
LOGGER.error(format_exc())
|
| 242 |
+
return {"code": 69, "message": e}
|
| 243 |
+
|
| 244 |
except Exception as e:
|
| 245 |
LOGGER.error(e)
|
| 246 |
LOGGER.error(format_exc())
|
requirements.txt
CHANGED
|
@@ -9,7 +9,7 @@ charset-normalizer==3.4.0
|
|
| 9 |
dnspython==2.6.1
|
| 10 |
google==3.0.0
|
| 11 |
gpytranslate==1.5.1
|
| 12 |
-
httpx
|
| 13 |
lyricsgenius==3.0.1
|
| 14 |
pillow == 10.3.0
|
| 15 |
lottie==0.7.1
|
|
@@ -18,7 +18,7 @@ pillow == 10.3.0
|
|
| 18 |
prettyconf==2.2.1
|
| 19 |
pyaes==1.6.1
|
| 20 |
pymongo==4.6.3
|
| 21 |
-
git+https://github.com/KurimuzonAkuma/pyrogram.git@v2.1.
|
| 22 |
pysocks==1.7.1
|
| 23 |
python-dateutil==2.8.2
|
| 24 |
pytube==15.0.0
|
|
|
|
| 9 |
dnspython==2.6.1
|
| 10 |
google==3.0.0
|
| 11 |
gpytranslate==1.5.1
|
| 12 |
+
httpx==0.27.2
|
| 13 |
lyricsgenius==3.0.1
|
| 14 |
pillow == 10.3.0
|
| 15 |
lottie==0.7.1
|
|
|
|
| 18 |
prettyconf==2.2.1
|
| 19 |
pyaes==1.6.1
|
| 20 |
pymongo==4.6.3
|
| 21 |
+
git+https://github.com/KurimuzonAkuma/pyrogram.git@v2.1.34
|
| 22 |
pysocks==1.7.1
|
| 23 |
python-dateutil==2.8.2
|
| 24 |
pytube==15.0.0
|