randydev commited on
Commit
b34b256
Β·
verified Β·
1 Parent(s): 834f373

Update Akeno/plugins/youtube.py

Browse files
Files changed (1) hide show
  1. Akeno/plugins/youtube.py +12 -11
Akeno/plugins/youtube.py CHANGED
@@ -3,6 +3,7 @@ import time
3
 
4
  import requests
5
  from pyrogram.types import Message
 
6
  from youtube_search import YoutubeSearch
7
  from yt_dlp import YoutubeDL
8
 
@@ -23,7 +24,7 @@ custom_loading = "<emoji id=5974235702701853774>πŸ—Ώ</emoji>"
23
  & filters.me
24
  & ~filters.forwarded
25
  )
26
- async def youtube_search_audio(_, message: Message):
27
  if len(message.command) < 2:
28
  return await message.reply_text(
29
  "Give a valid youtube search to download audio."
@@ -37,7 +38,7 @@ async def youtube_search_audio(_, message: Message):
37
  status, url = YoutubeDriver.check_url(okk)
38
  if not status:
39
  return await pro.edit_text(url)
40
- if client.me_is_premium:
41
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
42
  else:
43
  await pro.edit_text(f"__Downloading audio ...__")
@@ -46,7 +47,7 @@ async def youtube_search_audio(_, message: Message):
46
  yt_data = ytdl.extract_info(url, False)
47
  yt_file = ytdl.prepare_filename(yt_data)
48
  ytdl.process_info(yt_data)
49
- if client.me_is_premium:
50
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
51
  else:
52
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
@@ -83,7 +84,7 @@ async def youtube_search_audio(_, message: Message):
83
  & filters.me
84
  & ~filters.forwarded
85
  )
86
- async def youtube_audio(_, message: Message):
87
  if len(message.command) < 2:
88
  return await message.reply_text(
89
  "Give a valid youtube link to download audio."
@@ -93,7 +94,7 @@ async def youtube_audio(_, message: Message):
93
  status, url = YoutubeDriver.check_url(query)
94
  if not status:
95
  return await pro.edit_text(url)
96
- if client.me_is_premium:
97
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
98
  else:
99
  await pro.edit_text(f"__Downloading audio ...__")
@@ -102,7 +103,7 @@ async def youtube_audio(_, message: Message):
102
  yt_data = ytdl.extract_info(url, False)
103
  yt_file = ytdl.prepare_filename(yt_data)
104
  ytdl.process_info(yt_data)
105
- if client.me_is_premium:
106
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
107
  else:
108
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
@@ -153,7 +154,7 @@ async def ytvideo_search(client: Client, message: Message):
153
  status, url = YoutubeDriver.check_url(okk)
154
  if not status:
155
  return await pro.edit_text(url)
156
- if client.me_is_premium:
157
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
158
  else:
159
  await pro.edit_text(f"__Downloading audio ...__")
@@ -162,7 +163,7 @@ async def ytvideo_search(client: Client, message: Message):
162
  yt_data = ytdl.extract_info(url, True)
163
  yt_file = yt_data["id"]
164
 
165
- if client.me_is_premium:
166
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
167
  else:
168
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
@@ -207,7 +208,7 @@ async def ytvideo(client: Client, message: Message):
207
  status, url = YoutubeDriver.check_url(query)
208
  if not status:
209
  return await pro.edit_text(url)
210
- if client.me_is_premium:
211
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
212
  else:
213
  await pro.edit_text(f"__Downloading audio ...__")
@@ -216,7 +217,7 @@ async def ytvideo(client: Client, message: Message):
216
  yt_data = ytdl.extract_info(url, True)
217
  yt_file = yt_data["id"]
218
 
219
- if client.me_is_premium:
220
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
221
  else:
222
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
@@ -272,4 +273,4 @@ module.add_command("yta", "Download the youtube link video in .mp3 format!.")
272
  module.add_command("ytv", "Download the youtube link video in .mp3 format!.")
273
  module.add_command("ytsa", "Download the youtube search video in .mp3 format!.")
274
  module.add_command("ytva", "Download the youtube search video in .mp4 format!")
275
- module.add_command("ytlink", "Search for a video on youtube")
 
3
 
4
  import requests
5
  from pyrogram.types import Message
6
+ from pyrogram import Client, filters
7
  from youtube_search import YoutubeSearch
8
  from yt_dlp import YoutubeDL
9
 
 
24
  & filters.me
25
  & ~filters.forwarded
26
  )
27
+ async def youtube_search_audio(client: Client, message: Message):
28
  if len(message.command) < 2:
29
  return await message.reply_text(
30
  "Give a valid youtube search to download audio."
 
38
  status, url = YoutubeDriver.check_url(okk)
39
  if not status:
40
  return await pro.edit_text(url)
41
+ if client.me.is_premium:
42
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
43
  else:
44
  await pro.edit_text(f"__Downloading audio ...__")
 
47
  yt_data = ytdl.extract_info(url, False)
48
  yt_file = ytdl.prepare_filename(yt_data)
49
  ytdl.process_info(yt_data)
50
+ if client.me.is_premium:
51
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
52
  else:
53
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
 
84
  & filters.me
85
  & ~filters.forwarded
86
  )
87
+ async def youtube_audio(client: Client, message: Message):
88
  if len(message.command) < 2:
89
  return await message.reply_text(
90
  "Give a valid youtube link to download audio."
 
94
  status, url = YoutubeDriver.check_url(query)
95
  if not status:
96
  return await pro.edit_text(url)
97
+ if client.me.is_premium:
98
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
99
  else:
100
  await pro.edit_text(f"__Downloading audio ...__")
 
103
  yt_data = ytdl.extract_info(url, False)
104
  yt_file = ytdl.prepare_filename(yt_data)
105
  ytdl.process_info(yt_data)
106
+ if client.me.is_premium:
107
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
108
  else:
109
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
 
154
  status, url = YoutubeDriver.check_url(okk)
155
  if not status:
156
  return await pro.edit_text(url)
157
+ if client.me.is_premium:
158
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
159
  else:
160
  await pro.edit_text(f"__Downloading audio ...__")
 
163
  yt_data = ytdl.extract_info(url, True)
164
  yt_file = yt_data["id"]
165
 
166
+ if client.me.is_premium:
167
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
168
  else:
169
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
 
208
  status, url = YoutubeDriver.check_url(query)
209
  if not status:
210
  return await pro.edit_text(url)
211
+ if client.me.is_premium:
212
  await pro.edit_text(f"{custom_loading}__Downloading audio ...__")
213
  else:
214
  await pro.edit_text(f"__Downloading audio ...__")
 
217
  yt_data = ytdl.extract_info(url, True)
218
  yt_file = yt_data["id"]
219
 
220
+ if client.me.is_premium:
221
  upload_text = f"**{custom_loading}π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
222
  else:
223
  upload_text = f"**π–΄π—‰π—…π—ˆπ–Ίπ–½π—‚π—‡π—€ π–²π—ˆπ—‡π—€ ...** \n\n**𝖳𝗂𝗍𝗅𝖾:** `{yt_data['title'][:50]}`\n**𝖒𝗁𝖺𝗇𝗇𝖾𝗅:** `{yt_data['channel']}`"
 
273
  module.add_command("ytv", "Download the youtube link video in .mp3 format!.")
274
  module.add_command("ytsa", "Download the youtube search video in .mp3 format!.")
275
  module.add_command("ytva", "Download the youtube search video in .mp4 format!")
276
+ module.add_command("ytlink", "Search for a video on youtube")