Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,25 +6,32 @@ bot = telebot.TeleBot(TOKEN)
|
|
| 6 |
|
| 7 |
@bot.message_handler(commands=['start'])
|
| 8 |
def start(message):
|
| 9 |
-
bot.reply_to(message, "
|
| 10 |
|
| 11 |
@bot.message_handler(func=lambda m: True)
|
| 12 |
def download(message):
|
| 13 |
url = message.text
|
| 14 |
-
bot.reply_to(message, "⏳
|
|
|
|
| 15 |
try:
|
| 16 |
-
#
|
| 17 |
api_url = f"https://api.tiklydown.eu.org/api/download?url={url}"
|
| 18 |
res = requests.get(api_url).json()
|
|
|
|
| 19 |
|
| 20 |
-
# ال
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
if video:
|
| 24 |
bot.send_video(message.chat.id, video)
|
|
|
|
| 25 |
else:
|
| 26 |
-
bot.
|
|
|
|
| 27 |
except:
|
| 28 |
-
bot.
|
| 29 |
|
| 30 |
bot.infinity_polling()
|
|
|
|
| 6 |
|
| 7 |
@bot.message_handler(commands=['start'])
|
| 8 |
def start(message):
|
| 9 |
+
bot.reply_to(message, "البوت جاهز يا محمد! ابعت أي رابط (تيك توك، فيسبوك، إنستا، يوتيوب).")
|
| 10 |
|
| 11 |
@bot.message_handler(func=lambda m: True)
|
| 12 |
def download(message):
|
| 13 |
url = message.text
|
| 14 |
+
status_msg = bot.reply_to(message, "⏳ جاري محاولة التحميل...")
|
| 15 |
+
|
| 16 |
try:
|
| 17 |
+
# الطريقة الأولى (سيرفر Tiklydown)
|
| 18 |
api_url = f"https://api.tiklydown.eu.org/api/download?url={url}"
|
| 19 |
res = requests.get(api_url).json()
|
| 20 |
+
video = res.get('video', {}).get('noWatermark') or res.get('url')
|
| 21 |
|
| 22 |
+
# لو الطريقة الأولى منفعتش، نجرب الطريقة الثانية (سيرفر Lores)
|
| 23 |
+
if not video:
|
| 24 |
+
api_url_2 = f"https://api.lorescripts.org/api/download?url={url}"
|
| 25 |
+
res_2 = requests.get(api_url_2).json()
|
| 26 |
+
video = res_2.get('data', {}).get('url')
|
| 27 |
+
|
| 28 |
if video:
|
| 29 |
bot.send_video(message.chat.id, video)
|
| 30 |
+
bot.delete_message(message.chat.id, status_msg.message_id)
|
| 31 |
else:
|
| 32 |
+
bot.edit_message_text("❌ السيرفر مش عارف يسحب الفيديو ده، جرب رابط تاني.", message.chat.id, status_msg.message_id)
|
| 33 |
+
|
| 34 |
except:
|
| 35 |
+
bot.edit_message_text("❌ حصل خطأ فني، جرب كمان شوية.", message.chat.id, status_msg.message_id)
|
| 36 |
|
| 37 |
bot.infinity_polling()
|