Spaces:
Running
Running
update
Browse files- akn/AllDownloaderBot/main.py +5 -17
akn/AllDownloaderBot/main.py
CHANGED
@@ -413,7 +413,7 @@ async def TeraboxDL(url):
|
|
413 |
except Exception as e:
|
414 |
return {"error": str(e)}
|
415 |
|
416 |
-
async def download_m3u8(url, save_path="terabox.
|
417 |
api_url = f"https://teraboxdownloaderonline.com/api/download-m3u8?terabox_link={url}"
|
418 |
|
419 |
async with httpx.AsyncClient() as clientv:
|
@@ -424,14 +424,6 @@ async def download_m3u8(url, save_path="terabox.m3u8"):
|
|
424 |
file.write(response.content)
|
425 |
return save_path
|
426 |
|
427 |
-
async def convert_m3u8_to_mp4(m3u8_file, output_mp4="terabox.mp4"):
|
428 |
-
cmd = [
|
429 |
-
"ffmpeg", "-i", m3u8_file, "-c", "copy", "-bsf:a", "aac_adtstoasc", output_mp4
|
430 |
-
]
|
431 |
-
process = await asyncio.create_subprocess_exec(*cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
432 |
-
await process.communicate()
|
433 |
-
return output_mp4 if os.path.exists(output_mp4) else None
|
434 |
-
|
435 |
@Client.on_message(
|
436 |
~filters.scheduled
|
437 |
& filters.command(["terabox2dl"])
|
@@ -448,7 +440,7 @@ async def terabox2_cmd(client: Client, message: Message):
|
|
448 |
user = await client.get_chat_member(update_channel, user_id)
|
449 |
if user.status == ChatMemberStatus.BANNED:
|
450 |
return await message.reply_text(f"β {nn} Anda telah diblokir dari grup dukungan.")
|
451 |
-
except
|
452 |
return await message.reply_text(
|
453 |
f"ππ» Halo {nn}, Anda perlu join channel kami untuk menggunakan bot ini.",
|
454 |
reply_markup=InlineKeyboardMarkup([
|
@@ -462,13 +454,9 @@ async def terabox2_cmd(client: Client, message: Message):
|
|
462 |
|
463 |
pro = await message.reply_text("π **Processing...**")
|
464 |
|
465 |
-
|
466 |
-
if not m3u8_file:
|
467 |
-
return await pro.edit_text("β Gagal mendapatkan file M3U8.")
|
468 |
-
|
469 |
-
mp4_file = await convert_m3u8_to_mp4(m3u8_file)
|
470 |
if not mp4_file:
|
471 |
-
return await pro.edit_text("β Gagal
|
472 |
|
473 |
upload_text = "**β¬οΈ Uploading video...**"
|
474 |
thumb_path = "terabox.jpg"
|
@@ -490,7 +478,7 @@ async def terabox2_cmd(client: Client, message: Message):
|
|
490 |
"β¬οΈ Uploading video...."
|
491 |
)
|
492 |
)
|
493 |
-
os.remove(
|
494 |
os.remove(mp4_file)
|
495 |
await pro.delete()
|
496 |
|
|
|
413 |
except Exception as e:
|
414 |
return {"error": str(e)}
|
415 |
|
416 |
+
async def download_m3u8(url, save_path="terabox.mp4"):
|
417 |
api_url = f"https://teraboxdownloaderonline.com/api/download-m3u8?terabox_link={url}"
|
418 |
|
419 |
async with httpx.AsyncClient() as clientv:
|
|
|
424 |
file.write(response.content)
|
425 |
return save_path
|
426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
@Client.on_message(
|
428 |
~filters.scheduled
|
429 |
& filters.command(["terabox2dl"])
|
|
|
440 |
user = await client.get_chat_member(update_channel, user_id)
|
441 |
if user.status == ChatMemberStatus.BANNED:
|
442 |
return await message.reply_text(f"β {nn} Anda telah diblokir dari grup dukungan.")
|
443 |
+
except UserNotParticipant:
|
444 |
return await message.reply_text(
|
445 |
f"ππ» Halo {nn}, Anda perlu join channel kami untuk menggunakan bot ini.",
|
446 |
reply_markup=InlineKeyboardMarkup([
|
|
|
454 |
|
455 |
pro = await message.reply_text("π **Processing...**")
|
456 |
|
457 |
+
mp4_file = await download_m3u8(link)
|
|
|
|
|
|
|
|
|
458 |
if not mp4_file:
|
459 |
+
return await pro.edit_text("β Gagal mendapatkan file mp4.")
|
460 |
|
461 |
upload_text = "**β¬οΈ Uploading video...**"
|
462 |
thumb_path = "terabox.jpg"
|
|
|
478 |
"β¬οΈ Uploading video...."
|
479 |
)
|
480 |
)
|
481 |
+
os.remove(thumb_path)
|
482 |
os.remove(mp4_file)
|
483 |
await pro.delete()
|
484 |
|