from flask import Flask, request, jsonify, render_template_string, send_from_directory import os import glob import re app = Flask(__name__) VIDEO_DIR = "/data" OWNER_TG = "Virat_K0hli_18" PREMIUM_LINK = "https://drive.google.com/open?id=1lCzpPsjohRGR40kDDA-p2So-S2G1ZzZy" HTML_TEMPLATE = """ 🔥 PREMIUM CAPCUT COURSE 🔥

🎬 Premium Capcut Course

Master Video Editing — All Lectures in One Place

PREMIUM 4K
Capcut Premium Resources
🎬 Select a lecture 0 / 0

📚 Lectures

0
Total Lectures
0 GB
Total Size
Premium Quality
0m
Total Duration
Contact Owner

Any issue with my project? Reach out directly on Telegram

""" # ========== HELPERS ========== def get_videos(): videos = [] if not os.path.exists(VIDEO_DIR): return videos for ext in ['*.mp4', '*.mkv', '*.avi', '*.mov', '*.webm']: videos.extend(glob.glob(os.path.join(VIDEO_DIR, ext))) videos = sorted(videos, key=lambda x: int(''.join(filter(str.isdigit, x.split('/')[-1])) or 0)) result = [] for v in videos: size = os.path.getsize(v) if os.path.exists(v) else 0 result.append({ "id": len(result) + 1, "name": os.path.basename(v), "url": f"/data/{os.path.basename(v)}", "size": size, "path": v }) return result # ========== ROUTES ========== @app.route('/') def index(): return render_template_string(HTML_TEMPLATE, owner_tg=OWNER_TG, premium_link=PREMIUM_LINK) @app.route('/data/') def serve_video(filename): return send_from_directory(VIDEO_DIR, filename, as_attachment=False) @app.route('/api/videos') def api_videos(): videos = get_videos() return jsonify({ "total": len(videos), "videos": videos, "status": "success" }) @app.route('/health') def health(): return jsonify({"status": "healthy", "videos": len(get_videos())}) if __name__ == '__main__': app.run(host='0.0.0.0', port=7860, debug=False)