import os, subprocess, asyncio, threading, time, random, re from pyrogram import Client, filters, idle from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from flask import Flask, render_template_string # --- MINI WEB APP ENGINE --- webapp = Flask(__name__) WEB_TEMPLATE = """ Ultimate Deep Bypass Dashboard

šŸš€ WH Deep Bypass Bot v3.6 (Intro Integrated)

šŸ¤– Bot Status: ONLINE

System Core Engine v3.6 is running flawlessly with Intro/Outro Merger.

šŸŽµ Audio & Concat Booster

Mode: High-Pitch Sharp Audio

Equalizer: Treble Boost Enabled

Merger: Auto Intro/Outro Scale

šŸŒ«ļø Blur, Logo & Subtitle Core

Default Blur Strength: 30:20

Logo Overlay: Dynamic Filter Chain

Subtitle Font: Arial (Size 15)

""" @webapp.route('/') def home(): return render_template_string(WEB_TEMPLATE) def run_flask(): webapp.run(host='0.0.0.0', port=7860) # --- CONFIGURATION --- API_ID, API_HASH = 30074411, "eb00f53ab32888d0fa9e282e932011b9" BOT_TOKEN = "8673978980:AAFW_A9MKnHsuXU9rl8fw860lyrnBih7irg" BOT_PASSWORD = "131019" INTRO_FILENAME = "my_intro.mp4" # ဆရာ့ ရှေ့နောက် Intro į€–į€­į€Æį€„į€ŗį€”į€™į€Šį€ŗ LOGO_FILENAME = "logo.png" # --- SUBTITLE SETTINGS --- SUB_FONT_SIZE = 15 SUB_FONT_NAME = "Arial" SUB_COLOR = "&H00FFFF" # --- DEFAULT BLUR STRENGTH --- BLUR_STRENGTH = "30:20" app = Client("animated_pro_bot", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN) user_data = {} async def update_progress(msg, current_step, total_steps, status_text): frames = ["ā³", "āŒ›", "āš™ļø", "šŸ”§"] progress = int((current_step / total_steps) * 10) bar = "🟩" * progress + "⬜" * (10 - progress) running_man = "." * progress + "šŸƒšŸ’Ø" + "." * (10 - progress) text = ( f"🌟 **နခြေနနေ: {status_text}...** {frames[current_step % 4]}\n\n" f"šŸ›  **ပြုပြင်နေမှု:** {int((current_step/total_steps)*100)}%\n" f"ā”” {bar} šŸ\n" f"└─ {running_man}\n\n" f"šŸ’” *į€į€į€…į€±į€¬į€„į€·į€ŗį€•į€±į€øį€•į€«įŠ Ultimate Deep Bypass v3.6 ကို į€”į€žį€Æį€¶į€øį€•į€¼į€Æį€”į€±į€•į€«į€žį€Šį€ŗ!*" ) try: await msg.edit_text(text) except: pass def scale_srt_time(srt_path, scale_factor): def time_to_ms(t_str): h, m, s, ms = map(int, re.split('[:,]', t_str)) return h * 3600000 + m * 60000 + s * 1000 + ms def ms_to_time(ms): h, ms = divmod(ms, 3600000) m, ms = divmod(ms, 60000) s, ms = divmod(ms, 1000) return f"{h:02}:{m:02}:{s:02},{ms:03}" with open(srt_path, 'r', encoding='utf-8') as f: content = f.read() def replace_time(match): start_ms = time_to_ms(match.group(1)) end_ms = time_to_ms(match.group(2)) return f"{ms_to_time(int(start_ms * scale_factor))} --> {ms_to_time(int(end_ms * scale_factor))}" new_content = re.sub(r'(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})', replace_time, content) with open(srt_path, 'w', encoding='utf-8') as f: f.write(new_content) @app.on_message(filters.command("start") & filters.private) async def start(c, m): uid = m.chat.id user_data[uid] = {'auth': False, 'srt': None, 'video': None, 'ratio': 'original', 'blur_h': 0.25, 'blur_pos': 0.0, 'blur_side': 'bottom', 'use_logo': False} await m.reply_text("šŸ” Password į€›į€­į€Æį€€į€ŗį€‘į€Šį€·į€ŗį€•į€±į€øį€•į€«į€—į€»į‹") @app.on_message(filters.text & filters.private & ~filters.me & ~filters.command("start")) async def check_pw(c, m): uid = m.chat.id if user_data.get(uid, {}).get('auth'): return if m.text == BOT_PASSWORD: user_data.setdefault(uid, {})['auth'] = True await m.reply_text("āœ… Bot į€”į€†į€„į€ŗį€žį€„į€·į€ŗį€–į€¼į€…į€ŗį€•į€«į€•į€¼į€®! SRT နရင်ပို့ပြီးမှ Video ပို့ပါ။") else: await m.reply_text("āŒ Password į€™į€¾į€¬į€øį€šį€½į€„į€ŗį€øį€•į€«į€žį€Šį€ŗį‹") @app.on_message((filters.document | filters.video) & filters.private & ~filters.me) async def handle_files(c, m): uid = m.chat.id if not user_data.get(uid, {}).get('auth'): return if m.document and m.document.file_name.endswith('.srt'): user_data[uid]['srt'] = await m.download(file_name=f"s_{uid}.srt") await m.reply_text("šŸ“ SRT į€œį€€į€ŗį€į€¶į€›į€›į€¾į€­į€•į€«į€•į€¼į€®į‹ į€—į€®į€’į€®į€šį€­į€Æ ပို့ပါ။") elif m.video or (m.document and m.document.file_name.endswith('.mp4')): user_data[uid]['video'] = await m.download(file_name=f"v_{uid}.mp4") kb = InlineKeyboardMarkup([ [InlineKeyboardButton("šŸ–¼ļø Logo į€‘į€Šį€·į€ŗį€™į€Šį€ŗ", callback_data="logo_yes"), InlineKeyboardButton("🚫 Logo į€™į€‘į€Šį€·į€ŗį€•į€«", callback_data="logo_no")] ]) await m.reply_text("šŸ”– į€—į€®į€’į€®į€šį€­į€Æį€™į€¾į€¬ ဆရာ့ Logo į€‘į€Šį€·į€ŗį€žį€½į€„į€ŗį€øį€œį€­į€Æį€•į€«į€žį€œį€¬į€ø-", reply_markup=kb) @app.on_callback_query() async def callback_handler(c, cb): uid = cb.message.chat.id if cb.data.startswith("logo_"): user_data[uid]['use_logo'] = (cb.data == "logo_yes") kb = InlineKeyboardMarkup([ [InlineKeyboardButton("šŸ“± 9:16 (TikTok/Reels)", callback_data="ratio_916"), InlineKeyboardButton("šŸ“ŗ 16:9 (YouTube)", callback_data="ratio_169")], [InlineKeyboardButton("🟦 1:1 (Facebook/Square)", callback_data="ratio_11"), InlineKeyboardButton("šŸŽ„ မူရင်းဆိုဒ် (Original)", callback_data="ratio_original")] ]) await cb.message.edit_text("šŸ“ į€—į€®į€’į€®į€šį€­į€Æ ဆိုဒ် (Aspect Ratio) ကို į€›į€½į€±į€øį€į€»į€šį€ŗį€•į€«-", reply_markup=kb) elif cb.data.startswith("ratio_"): user_data[uid]['ratio'] = cb.data.replace("ratio_", "") kb = InlineKeyboardMarkup([ [InlineKeyboardButton("šŸ¤ į€”į€žį€±į€ø (၁၅%)", callback_data="bh_0.15"), InlineKeyboardButton("šŸ“ į€”į€œį€į€ŗ (၂၅%)", callback_data="bh_0.25")], [InlineKeyboardButton("🧱 နကြီး (įƒį…%)", callback_data="bh_0.35"), InlineKeyboardButton("🚫 Blur į€™į€œį€Æį€•į€ŗį€•į€«", callback_data="bh_0.0")] ]) await cb.message.edit_text(f"šŸŒ«ļø Blur နမြင့် (Height) ကို į€›į€½į€±į€øį€į€»į€šį€ŗį€•į€« (ဆိုဒ်: {user_data[uid]['ratio']}):", reply_markup=kb) elif cb.data.startswith("bh_"): user_data[uid]['blur_h'] = float(cb.data.replace("bh_", "")) if user_data[uid]['blur_h'] == 0.0: user_data[uid]['blur_pos'] = 0.0 return await show_op_menu(cb, uid) kb = InlineKeyboardMarkup([ [InlineKeyboardButton("ā¬‡ļø နောက်ခြေကပ် (Bottom Sticky)", callback_data="bp_0.0")], [InlineKeyboardButton("ā¬†ļø နောက်ခြေမှ į€”į€Šį€ŗį€øį€”į€Šį€ŗį€øį€į€½į€¬ (Bottom Floating)", callback_data="bp_0.05")], [InlineKeyboardButton("šŸ” နပေါ်ဆုံးကပ် (Top Sticky)", callback_data="bp_top_0.0")], [InlineKeyboardButton("ā« နပေါ်ဆုံးမှ į€”į€Šį€ŗį€øį€”į€Šį€ŗį€øį€į€½į€¬ (Top Floating)", callback_data="bp_top_0.05")] ]) await cb.message.edit_text(f"šŸ“ Blur į€į€Šį€ŗį€”į€±į€›į€¬ (Position) ကို į€›į€½į€±į€øį€į€»į€šį€ŗį€•į€« (နမြင့်: {int(user_data[uid]['blur_h']*100)}%):", reply_markup=kb) elif cb.data.startswith("bp_"): pos_data = cb.data.replace("bp_", "") if pos_data.startswith("top_"): user_data[uid]['blur_side'] = "top" user_data[uid]['blur_pos'] = float(pos_data.replace("top_", "")) else: user_data[uid]['blur_side'] = "bottom" user_data[uid]['blur_pos'] = float(pos_data) await show_op_menu(cb, uid) elif cb.data.startswith("op_"): await process_video(c, cb) async def show_op_menu(cb, uid): h = user_data[uid].get('blur_h', 0.0) kb = InlineKeyboardMarkup([ [InlineKeyboardButton("šŸš€ Deep Bypass + စာတန်းထိုး", callback_data="op_sub_only")], [InlineKeyboardButton("ā¬‡ļø နောက်ခြေ Blur + စာတန်းထိုး", callback_data="op_bottom")], [InlineKeyboardButton("ā¬†ļø နပေါ်ပိုင်း Blur + စာတန်းထိုး", callback_data="op_top")], [InlineKeyboardButton("šŸ›”ļø Guard Only (į€˜į€šį€ŗį€Šį€¬į€™į€œį€¾į€”į€ŗį€•į€«)", callback_data="op_none")] ]) await cb.message.edit_text(f"āš™ļø į€•į€¼į€Æį€•į€¼į€„į€ŗį€™į€Šį€·į€ŗį€•į€Æį€¶į€…į€¶ (Mode) ကို į€›į€½į€±į€øį€į€»į€šį€ŗį€•į€« (Blur: {int(h*100)}%, Logo: {'āœ…' if user_data[uid]['use_logo'] else 'āŒ'}):", reply_markup=kb) async def process_video(c, cb): uid = cb.message.chat.id d = user_data[uid] v_in, s_in = d.get('video'), d.get('srt') ratio = d.get('ratio', 'original') blur_h = d.get('blur_h', 0.25) blur_pos = d.get('blur_pos', 0.0) v_temp = f"temp_{uid}.mp4" v_out, ass_p, thumb = f"f_{uid}.mp4", f"s_{uid}.ass", f"t_{uid}.jpg" msg = await cb.message.edit_text("šŸš€ Deep Engine စတင်နေပါပြီ...") try: speed_factor = 1.02 pts_factor = 1 / speed_factor zoom_factor = 1.10 deep_vf = ( f"vignette=PI/10,hue=s=1.15,eq=contrast=1.08:gamma=1.02,noise=alls=5:all_seed=12345," f"scale='trunc({zoom_factor}*iw/2)*2':'trunc({zoom_factor}*ih/2)*2'," f"crop='trunc(iw/{zoom_factor}/2)*2':'trunc(ih/{zoom_factor}/2)*2'," f"setpts={pts_factor}*PTS" ) if ratio == "916": ratio_vf = "scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(720-iw)/2:(1280-ih)/2:color=black" target_w, target_h = 720, 1280 elif ratio == "169": ratio_vf = "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(1280-iw)/2:(720-ih)/2:color=black" target_w, target_h = 1280, 720 elif ratio == "11": ratio_vf = "scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:(1080-iw)/2:(1080-ih)/2:color=black" target_w, target_h = 1080, 1080 else: ratio_vf = "" target_w, target_h = 720, 1280 # Default fallback dimension for safety match base_vf = deep_vf if ratio_vf: base_vf = f"{base_vf},{ratio_vf}" base_vf = f"{base_vf},scale='trunc(iw/2)*2':'trunc(ih/2)*2',format=yuv420p" # --- AUDIO CORE --- af_pro = f"atempo={speed_factor},equalizer=f=3000:width_type=h:width=200:g=12,aecho=0.8:0.7:40:0.3,loudnorm=I=-16:TP=-1.5:LRA=11,lowpass=f=16000,highpass=f=60" await update_progress(msg, 1, 6, "Bypass Filters များ į€‘į€Šį€·į€ŗį€žį€½į€„į€ŗį€øį€”į€±į€žį€Šį€ŗ") input_args = ["-i", v_in] has_logo = d['use_logo'] and os.path.exists(LOGO_FILENAME) if has_logo: input_args += ["-i", LOGO_FILENAME] if cb.data == "op_none": if has_logo: final_vf = f"{base_vf}[vid];[1:v]scale=120:-1[logo];[vid][logo]overlay=W-w-20:20" else: final_vf = base_vf else: await update_progress(msg, 2, 6, "စာတန်းထိုး နချိန်နှင့် į€•į€Æį€¶į€…į€¶į€Šį€¾į€­į€”į€±į€žį€Šį€ŗ") if not s_in: return await cb.message.reply_text("āŒ SRT နရင်ပို့ပါ!") scale_srt_time(s_in, pts_factor) subprocess.run(["ffmpeg", "-y", "-i", s_in, ass_p], check=True) with open(ass_p, 'r', encoding='utf-8') as f: lines = f.readlines() style_line = f"Style: Default,{SUB_FONT_NAME},{SUB_FONT_SIZE},{SUB_COLOR},&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,2,2,10,10,50,1" new_lines = [style_line if l.startswith('Style: Default') else l for l in lines] with open(ass_p, 'w', encoding='utf-8') as f: f.writelines(new_lines) bs = BLUR_STRENGTH # --- FILTER CHAIN (LOGO + BLUR + SUBTITLE) --- if cb.data == "op_sub_only": if has_logo: final_vf = f"hflip,{base_vf}[vid];[1:v]scale=120:-1[logo];[vid][logo]overlay=W-w-20:20,ass='{ass_p}'" else: final_vf = f"hflip,{base_vf},ass='{ass_p}'" elif cb.data == "op_bottom": y_pos = f"ih*(1-{blur_h}-{blur_pos})" if has_logo: final_vf = f"hflip,{base_vf}[v1];[v1]split[m1][m2];[m2]crop=iw:ih*{blur_h}:0:{y_pos},boxblur={bs}[bl];[m1][bl]overlay=0:{y_pos}[v_blur];[v_blur][1:v]scale=120:-1[logo];[v_blur][logo]overlay=W-w-20:20,ass='{ass_p}'" else: final_vf = f"hflip,{base_vf}[v1];[v1]split[m1][m2];[m2]crop=iw:ih*{blur_h}:0:{y_pos},boxblur={bs}[bl];[m1][bl]overlay=0:{y_pos},ass='{ass_p}'" elif cb.data == "op_top": y_pos = f"ih*{blur_pos}" if has_logo: final_vf = f"hflip,{base_vf}[v1];[v1]split[m1][m2];[m2]crop=iw:ih*{blur_h}:0:{y_pos},boxblur={bs}[bl];[m1][bl]overlay=0:{y_pos}[v_blur];[v_blur][1:v]scale=120:-1[logo];[v_blur][logo]overlay=W-w-20:20,ass='{ass_p}'" else: final_vf = f"hflip,{base_vf}[v1];[v1]split[m1][m2];[m2]crop=iw:ih*{blur_h}:0:{y_pos},boxblur={bs}[bl];[m1][bl]overlay=0:{y_pos},ass='{ass_p}'" await update_progress(msg, 3, 6, "Deep AI Bypass ဖြင့် į€—į€®į€’į€®į€šį€­į€Æ į€‘į€Æį€į€ŗį€”į€±į€žį€Šį€ŗ") cmd = ["ffmpeg", "-y"] + input_args + [ "-filter_complex", final_vf, "-af", af_pro, "-r", "24.95", "-vcodec", "libx264", "-crf", "22", "-preset", "fast", "-map_metadata", "-1", "-metadata:s:v:0", "handler_name=DeepVideoHandler", "-metadata:s:a:0", "handler_name=DeepSoundHandler", v_temp ] process = subprocess.run(cmd, capture_output=True, text=True) if process.returncode != 0: raise Exception(f"FFmpeg Error: {process.stderr}") # --- INTRO & OUTRO MERGER SYSTEM --- if os.path.exists(INTRO_FILENAME): await update_progress(msg, 4, 6, "ရှေ့နောက် Intro/Outro များ į€į€»į€­į€į€ŗį€†į€€į€ŗį€”į€±į€žį€Šį€ŗ") # Intro ရော Main Video ရော Frame Size, Sample Rate, Audio Layout į€€į€­į€Æį€€į€ŗį€Šį€®į€”į€±į€¬į€„į€ŗ į€Šį€¾į€­į€•į€¼į€®į€ø Concat į€œį€Æį€•į€ŗį€žį€Šį€·į€ŗ Complex Filter concat_cmd = [ "ffmpeg", "-y", "-i", INTRO_FILENAME, "-i", v_temp, "-i", INTRO_FILENAME, "-filter_complex", f"[0:v]scale={target_w}:{target_h}:force_original_aspect_ratio=decrease,pad={target_w}:{target_h}:({target_w}-iw)/2:({target_h}-ih)/2,setsar=1[v0];" f"[1:v]scale={target_w}:{target_h}:force_original_aspect_ratio=decrease,pad={target_w}:{target_h}:({target_w}-iw)/2:({target_h}-ih)/2,setsar=1[v1];" f"[2:v]scale={target_w}:{target_h}:force_original_aspect_ratio=decrease,pad={target_w}:{target_h}:({target_w}-iw)/2:({target_h}-ih)/2,setsar=1[v2];" f"[0:a]aresample=44100,pan=stereo|c0=c0|c1=c1[a0];" f"[1:a]aresample=44100,pan=stereo|c0=c0|c1=c1[a1];" f"[2:a]aresample=44100,pan=stereo|c0=c0|c1=c1[a2];" f"[v0][a0][v1][a1][v2][a2]concat=n=3:v=1:a=1[v][a]", "-map", "[v]", "-map", "[a]", "-vcodec", "libx264", "-crf", "22", "-preset", "fast", v_out ] concat_process = subprocess.run(concat_cmd, capture_output=True, text=True) if concat_process.returncode != 0: raise Exception(f"Concat Error: {concat_process.stderr}") else: os.rename(v_temp, v_out) await update_progress(msg, 5, 6, "Metadata များ နမြစ်ပြတ် į€–į€»į€€į€ŗį€”į€±į€žį€Šį€ŗ") subprocess.run(["ffmpeg", "-y", "-i", v_out, "-ss", "00:00:01", "-vframes", "1", thumb], check=True) try: subprocess.run(["exiftool", "-all=", "-overwrite_original", v_out]) except: pass await update_progress(msg, 6, 6, "Deep Bypass į€”į€±į€¬į€„į€ŗį€™į€¼į€„į€ŗį€•į€«į€žį€Šį€ŗ") await cb.message.reply_video( v_out, thumb=thumb, caption=f"āœ… **Ultimate Deep Bypass v3.6 į€”į€±į€¬į€„į€ŗį€™į€¼į€„į€ŗį€•į€«į€žį€Šį€ŗ!**\n\nšŸ“ *ဆိုဒ်:* {ratio}\nšŸ›”ļø *į€”į€Šį€ŗį€øį€•į€Šį€¬:* Intro/Outro Auto-Concat, Treble Audio Booster, Logo Overlay, Subtitle Sync (1.02x), Metadata Wipe." ) await msg.delete() except Exception as e: await cb.message.reply_text(f"āŒ į€”į€™į€¾į€¬į€øį€”į€šį€½į€„į€ŗį€ø: {str(e)}") for f in [v_in, v_temp, v_out, ass_p, s_in, thumb]: if f and os.path.exists(f): os.remove(f) async def main(): await app.start() print("Ultimate Deep Bypass Bot v3.6 (Intro Engine Added) is running...") await idle() if __name__ == "__main__": threading.Thread(target=run_flask, daemon=True).start() asyncio.get_event_loop().run_until_complete(main())