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())