Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
3729bd9
1
Parent(s):
d011898
.....
Browse files- Powers/plugins/locks.py +2 -1
- Powers/utils/web_helpers.py +9 -7
- app.json +1 -1
Powers/plugins/locks.py
CHANGED
@@ -461,11 +461,12 @@ async def is_approved_user(c:Gojo, m: Message):
|
|
461 |
return False
|
462 |
elif m.forward_from_chat:
|
463 |
x_chat = (await c.get_chat(m.forward_from_chat.id)).linked_chat
|
|
|
|
|
464 |
if not x_chat:
|
465 |
return False
|
466 |
elif x_chat and x_chat.id == m.chat.id:
|
467 |
return True
|
468 |
-
return False
|
469 |
elif m.from_user:
|
470 |
if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == Config.BOT_ID:
|
471 |
return True
|
|
|
461 |
return False
|
462 |
elif m.forward_from_chat:
|
463 |
x_chat = (await c.get_chat(m.forward_from_chat.id)).linked_chat
|
464 |
+
if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == Config.BOT_ID:
|
465 |
+
return True
|
466 |
if not x_chat:
|
467 |
return False
|
468 |
elif x_chat and x_chat.id == m.chat.id:
|
469 |
return True
|
|
|
470 |
elif m.from_user:
|
471 |
if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == Config.BOT_ID:
|
472 |
return True
|
Powers/utils/web_helpers.py
CHANGED
@@ -63,8 +63,9 @@ async def song_search(query, is_direct, max_results=1):
|
|
63 |
videos = VideosSearch(query,max_results)
|
64 |
results = await videos.next()
|
65 |
except Exception as e:
|
66 |
-
|
67 |
-
|
|
|
68 |
nums = 1
|
69 |
for i in results["result"]:
|
70 |
durr = i['duration'].split(":")
|
@@ -164,7 +165,7 @@ async def youtube_downloader(c:Gojo,m:Message,query:str,is_direct:bool,type_:str
|
|
164 |
thumb = dicti["thumbnail"]
|
165 |
vid_dur = get_duration_in_sec(dicti["DURATION"])
|
166 |
published_on = dicti["published"]
|
167 |
-
thumb_ = await c.send_photo(
|
168 |
# FILE = ydl.extract_info(query,download=video)
|
169 |
url = query
|
170 |
thumb = await thumb_.download()
|
@@ -188,17 +189,18 @@ async def youtube_downloader(c:Gojo,m:Message,query:str,is_direct:bool,type_:str
|
|
188 |
if song:
|
189 |
audio_stream= yt.streams.filter(only_audio=True).first()
|
190 |
f_path = audio_stream.download()
|
191 |
-
file_path = f"./youtube_downloads/{f_name.strip()}.mp3"
|
|
|
192 |
os.rename(f_path,file_path)
|
193 |
await m.reply_audio(file_path,caption=cap,reply_markup=kb,duration=vid_dur,thumb=thumb,title=f_name)
|
194 |
-
os.remove(f_path)
|
195 |
os.remove(file_path)
|
196 |
os.remove(thumb)
|
197 |
return
|
198 |
elif video:
|
199 |
video_stream = yt.streams.get_highest_resolution()
|
200 |
-
video_stream.download(
|
201 |
-
file_path = f"./youtube_downloads/{f_name}.mp4"
|
202 |
await m.reply_video(file_path,caption=cap,reply_markup=kb,duration=vid_dur,thumb=thumb)
|
203 |
os.remove(file_path)
|
204 |
os.remove(thumb)
|
|
|
63 |
videos = VideosSearch(query,max_results)
|
64 |
results = await videos.next()
|
65 |
except Exception as e:
|
66 |
+
LOGGER.error(e)
|
67 |
+
LOGGER.error(format_exc())
|
68 |
+
return yt_dict
|
69 |
nums = 1
|
70 |
for i in results["result"]:
|
71 |
durr = i['duration'].split(":")
|
|
|
165 |
thumb = dicti["thumbnail"]
|
166 |
vid_dur = get_duration_in_sec(dicti["DURATION"])
|
167 |
published_on = dicti["published"]
|
168 |
+
thumb_ = await c.send_photo(MESSAGE_DUMP,thumb)
|
169 |
# FILE = ydl.extract_info(query,download=video)
|
170 |
url = query
|
171 |
thumb = await thumb_.download()
|
|
|
189 |
if song:
|
190 |
audio_stream= yt.streams.filter(only_audio=True).first()
|
191 |
f_path = audio_stream.download()
|
192 |
+
# file_path = f"./youtube_downloads/{f_name.strip()}.mp3"
|
193 |
+
file_path = f"./{f_name.strip()}.mp3"
|
194 |
os.rename(f_path,file_path)
|
195 |
await m.reply_audio(file_path,caption=cap,reply_markup=kb,duration=vid_dur,thumb=thumb,title=f_name)
|
196 |
+
# os.remove(f_path)
|
197 |
os.remove(file_path)
|
198 |
os.remove(thumb)
|
199 |
return
|
200 |
elif video:
|
201 |
video_stream = yt.streams.get_highest_resolution()
|
202 |
+
file_path = video_stream.download()
|
203 |
+
# file_path = f"./youtube_downloads/{f_name}.mp4"
|
204 |
await m.reply_video(file_path,caption=cap,reply_markup=kb,duration=vid_dur,thumb=thumb)
|
205 |
os.remove(file_path)
|
206 |
os.remove(thumb)
|
app.json
CHANGED
@@ -50,7 +50,7 @@
|
|
50 |
},
|
51 |
"MESSAGE_DUMP": {
|
52 |
"description": "Event logs channel where bot will send updates.",
|
53 |
-
"required":
|
54 |
"value": ""
|
55 |
},
|
56 |
"PREFIX_HANDLER": {
|
|
|
50 |
},
|
51 |
"MESSAGE_DUMP": {
|
52 |
"description": "Event logs channel where bot will send updates.",
|
53 |
+
"required": true,
|
54 |
"value": ""
|
55 |
},
|
56 |
"PREFIX_HANDLER": {
|