Dgbbhc commited on
Commit
9c59a03
·
verified ·
1 Parent(s): ce8c4c1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import telebot
2
+ import requests
3
+
4
+ # التوكن بتاعك
5
+ TOKEN = '8468827766:AAHnYY1BXQ2YFA0Lj86oTGG-GcXy3mOjXWo'
6
+ bot = telebot.TeleBot(TOKEN)
7
+
8
+ @bot.message_handler(commands=['start'])
9
+ def start(message):
10
+ bot.reply_to(message, "أهلاً يا محمد! ابعت رابط الفيديو (تيك توك، فيسبوك، إنستا، يوتيوب) وهبعتهولك حالاً.")
11
+
12
+ @bot.message_handler(func=lambda m: True)
13
+ def download_video(message):
14
+ url = message.text
15
+ msg = bot.reply_to(message, "جاري التحميل... انتظر لحظة")
16
+
17
+ try:
18
+ # رابط API التحميل الشامل
19
+ api_url = f"https://api.tiklydown.eu.org/api/download?url={url}"
20
+ response = requests.get(api_url).json()
21
+
22
+ # محاولة الحصول على رابط الفيديو المباشر
23
+ video_url = response.get('video', {}).get('noWatermark') or response.get('url')
24
+
25
+ if video_url:
26
+ bot.send_video(message.chat.id, video_url)
27
+ bot.delete_message(message.chat.id, msg.message_id)
28
+ else:
29
+ bot.edit_message_text("عذراً، لم أستطع العثور على الفيديو. تأكد من الرابط.", message.chat.id, msg.message_id)
30
+
31
+ except Exception as e:
32
+ bot.edit_message_text("حدث خطأ أثناء المعالجة، جرب رابطاً آخر.", message.chat.id, msg.message_id)
33
+
34
+ bot.infinity_polling()