Skip to content

Commit

Permalink
πŸ™ˆ
Browse files Browse the repository at this point in the history
  • Loading branch information
nandhunair1 authored Dec 14, 2021
1 parent 2de63be commit d8045ab
Showing 1 changed file with 1 addition and 85 deletions.
86 changes: 1 addition & 85 deletions jebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#For private messages
#Ignore commands
#No bots also allowed
@Jebot.on_message(filters.private & ~filters.bot & ~filters.command("help") & ~filters.command("start") & ~filters.command("s"))
@Jebot.on_message(filters.private & ~filters.bot & ~filters.edited & filters.group & ~filters.command("help") & ~filters.command("start") & ~filters.command("s"))
async def song(client, message):
#tvseriezzz_music #tvseriezzz_music
cap = "@tvseriezzz_music"
Expand Down Expand Up @@ -126,90 +126,6 @@ async def song(client, message):
await rkp.delete()


@Jebot.on_message(filters.text & ~filters.edited & filters.group)
async def song(client, message):
cap = "@tvseriezzz_music"
url = message.text.split(None, 1)[1]
rkp = await message.reply("Processing...")
if not url:
await rkp.edit("**What's the song you want?**\nUsage`/song <song name>`")
search = SearchVideos(url, offset=1, mode="json", max_results=1)
test = search.result()
p = json.loads(test)
q = p.get("search_result")
try:
url = q[0]["link"]
except BaseException:
return await rkp.edit("Failed to find that song.")
type = "audio"
if type == "audio":
opts = {
"format": "bestaudio",
"addmetadata": True,
"key": "FFmpegMetadata",
"writethumbnail": True,
"prefer_ffmpeg": True,
"geo_bypass": True,
"nocheckcertificate": True,
"postprocessors": [
{
"key": "FFmpegExtractAudio",
"preferredcodec": "mp3",
"preferredquality": "320",
}
],
"outtmpl": "%(id)s.mp3",
"quiet": True,
"logtostderr": False,
}
song = True
try:
await rkp.edit("Downloading....[🎧](https://te.legra.ph/file/c3dce12116a0a8af80c93.jpg)")
with YoutubeDL(opts) as rip:
rip_data = rip.extract_info(url)
except DownloadError as DE:
await rkp.edit(f"`{str(DE)}`")
return
except ContentTooShortError:
await rkp.edit("`The download content was too short.`")
return
except GeoRestrictedError:
await rkp.edit(
"`Video is not available from your geographic location due to geographic restrictions imposed by a website.`"
)
return
except MaxDownloadsReached:
await rkp.edit("`Max-downloads limit has been reached.`")
return
except PostProcessingError:
await rkp.edit("`There was an error during post processing.`")
return
except UnavailableVideoError:
await rkp.edit("`Media is not available in the requested format.`")
return
except XAttrMetadataError as XAME:
await rkp.edit(f"`{XAME.code}: {XAME.msg}\n{XAME.reason}`")
return
except ExtractorError:
await rkp.edit("`There was an error during info extraction.`")
return
except Exception as e:
await rkp.edit(f"{str(type(e)): {str(e)}}")
return
time.time()
if song:
await rkp.edit("Uploading .....[🎧](https://te.legra.ph/file/c3dce12116a0a8af80c93.jpg)") #tvseriezzz_music
lol = "./thumb.jpg"
lel = await message.reply_audio(
f"{rip_data['id']}.mp3",
duration=int(rip_data["duration"]),
title=str(rip_data["title"]),
performer=str(rip_data["uploader"]),
thumb=lol,
caption=cap) #tvseriezzz_music
await rkp.delete()


@Jebot.on_message(filters.command("start"))
async def start(client, message):
if message.chat.type == 'private':
Expand Down

0 comments on commit d8045ab

Please sign in to comment.