Captain Ezio commited on
Commit
948742f
·
1 Parent(s): 2cfc615
Powers/plugins/web_con.py CHANGED
@@ -304,6 +304,7 @@ async def download_instareels(c: Gojo, m: Message):
304
  content = insta.get_media()
305
 
306
  if content["code"] == 69 or content["message"] != "success":
 
307
  return await m.reply_text(content["message"])
308
 
309
  try:
 
304
  content = insta.get_media()
305
 
306
  if content["code"] == 69 or content["message"] != "success":
307
+ await to_edit.delete()
308
  return await m.reply_text(content["message"])
309
 
310
  try:
Powers/utils/web_helpers.py CHANGED
@@ -140,7 +140,7 @@ async def song_search(query, max_results=1):
140
  except Exception as e:
141
  LOGGER.error(e)
142
  LOGGER.error(format_exc())
143
- return yt_dict
144
  nums = 1
145
  for i in results["result"]:
146
  durr = i['duration'].split(":")
@@ -169,7 +169,7 @@ async def song_search(query, max_results=1):
169
  thumb = {"thumbnail": i["thumbnails"][0]["url"]}
170
  except Exception:
171
  thumb = {"thumbnail": None}
172
- dict_form |= thumb
173
  yt_dict[nums] = dict_form
174
  nums += 1
175
  return yt_dict
@@ -226,6 +226,9 @@ async def youtube_downloader(c: Gojo, m: Message, query: str, type_: str):
226
  ext = "mp4"
227
  # ydl = yt_dlp.YoutubeDL(opts)
228
  dicti = await song_search(query, 1)
 
 
 
229
  if not dicti and type(dicti) != str:
230
  await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
231
  elif type(dicti) == str:
 
140
  except Exception as e:
141
  LOGGER.error(e)
142
  LOGGER.error(format_exc())
143
+ return {0: e}
144
  nums = 1
145
  for i in results["result"]:
146
  durr = i['duration'].split(":")
 
169
  thumb = {"thumbnail": i["thumbnails"][0]["url"]}
170
  except Exception:
171
  thumb = {"thumbnail": None}
172
+ dict_form.update(thumb)
173
  yt_dict[nums] = dict_form
174
  nums += 1
175
  return yt_dict
 
226
  ext = "mp4"
227
  # ydl = yt_dlp.YoutubeDL(opts)
228
  dicti = await song_search(query, 1)
229
+ if err := dicti.get(0, None):
230
+ await m.reply_text(err)
231
+ return
232
  if not dicti and type(dicti) != str:
233
  await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
234
  elif type(dicti) == str:
Powers/utils/web_scrapper.py CHANGED
@@ -6,7 +6,6 @@ import httpx
6
 
7
  from Powers import *
8
 
9
-
10
  # import requests
11
  # from selenium import webdriver
12
  # from selenium.webdriver.chrome.options import Options
@@ -211,6 +210,7 @@ class SCRAP_DATA:
211
  # else:
212
  # return {}
213
 
 
214
 
215
  class INSTAGRAM:
216
  def __init__(self, url):
@@ -224,6 +224,8 @@ class INSTAGRAM:
224
  return httpx.post(
225
  f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
226
  ).json()
 
 
227
  except Exception as e:
228
  LOGGER.error(e)
229
  LOGGER.error(format_exc())
 
6
 
7
  from Powers import *
8
 
 
9
  # import requests
10
  # from selenium import webdriver
11
  # from selenium.webdriver.chrome.options import Options
 
210
  # else:
211
  # return {}
212
 
213
+ timeout = httpx.Timeout(20)
214
 
215
  class INSTAGRAM:
216
  def __init__(self, url):
 
224
  return httpx.post(
225
  f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
226
  ).json()
227
+ except httpx.ReadTimeout:
228
+ return self.get_media(self.url)
229
  except Exception as e:
230
  LOGGER.error(e)
231
  LOGGER.error(format_exc())
requirements.txt CHANGED
@@ -12,6 +12,7 @@ gpytranslate==1.5.1
12
  httpx
13
  lyricsgenius==3.0.1
14
  pillow == 10.3.0
 
15
  lxml==4.9.1
16
  pillow == 10.3.0
17
  prettyconf==2.2.1
 
12
  httpx
13
  lyricsgenius==3.0.1
14
  pillow == 10.3.0
15
+ lottie==0.7.1
16
  lxml==4.9.1
17
  pillow == 10.3.0
18
  prettyconf==2.2.1