From b5ea948525f434128cc849d1826abd14148ab933 Mon Sep 17 00:00:00 2001 From: rosachilov-design Date: Wed, 29 Oct 2025 01:08:07 +0300 Subject: [PATCH 1/4] Update app.py --- app.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index d82c51f0d..108c7bdb5 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,48 @@ -from flask import Flask -app = Flask(__name__) -@app.route('/') -def hello_world(): - return 'Hello, World!' +import logging +from telegram import Update +from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes +import yt_dlp + +logging.basicConfig(level=logging.INFO) + +BOT_TOKEN = "8414363077:AAFiflBPXEBqI08IlsHhfcvuhiHwrbaCZ2Q" + +async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): + await update.message.reply_text("Send me a video page URL, and I will extract video URLs for you (no downloading).") + +async def handle_url(update: Update, context: ContextTypes.DEFAULT_TYPE): + url = update.message.text.strip() + await update.message.reply_text("Extracting video URLs. Please wait...") + + ydl_opts = { + 'quiet': True, + 'skip_download': True, + 'no_warnings': True, + } + + try: + with yt_dlp.YoutubeDL(ydl_opts) as ydl: + info = ydl.extract_info(url, download=False) + formats = info.get('formats', []) + urls = [f['url'] for f in formats if f.get('url')] + if urls: + response = "Found video URLs:\n" + "\n".join(urls[:10]) # limiting to first 10 URLs + else: + response = "No video URLs found." + except Exception as e: + response = f"Error occurred: {e}" + + await update.message.reply_text(response) + + +def main(): + app = ApplicationBuilder().token(BOT_TOKEN).build() + app.add_handler(CommandHandler("start", start)) + app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_url)) + print("Bot is polling...") + app.run_polling() + + +if __name__ == '__main__': + main() From 9fd71fcc58d0c519ad16194415935b53ac8ad9dd Mon Sep 17 00:00:00 2001 From: rosachilov-design Date: Wed, 29 Oct 2025 01:09:31 +0300 Subject: [PATCH 2/4] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 147ddd086..12532cdc0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ Flask -Gunicorn +python-telegram-bot +yt-dlp \ No newline at end of file From b1d866f1d77a14ee7ff971bd00cc86c09309bd00 Mon Sep 17 00:00:00 2001 From: rosachilov-design Date: Wed, 29 Oct 2025 01:12:03 +0300 Subject: [PATCH 3/4] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 12532cdc0..b5bff5d01 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Flask python-telegram-bot -yt-dlp \ No newline at end of file +yt-dlp +gunicorn \ No newline at end of file From f037df045a7f90df3ff884d33f44a58d475a42d7 Mon Sep 17 00:00:00 2001 From: rosachilov-design Date: Wed, 29 Oct 2025 01:17:05 +0300 Subject: [PATCH 4/4] Update app.py --- app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.py b/app.py index 108c7bdb5..508d1d2de 100644 --- a/app.py +++ b/app.py @@ -4,6 +4,13 @@ from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes import yt_dlp +from flask import Flask +app = Flask(__name__) + +@app.route('/') +def hello(): + return "Hello world" + logging.basicConfig(level=logging.INFO) BOT_TOKEN = "8414363077:AAFiflBPXEBqI08IlsHhfcvuhiHwrbaCZ2Q"