forked from bipinkrish/Link-Bypasser-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
94 lines (76 loc) · 3.67 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import pyrogram
from pyrogram import Client
from pyrogram import filters
from pyrogram.types import InlineKeyboardMarkup,InlineKeyboardButton
import bypasser
import os
import ddl
import requests
import threading
from texts import HELP_TEXT
from bypasser import ddllist
# bot
bot_token = os.environ.get("TOKEN", "5129991605:AAHQst6lPTHwwgu9HoY95v3qye3P3aNJ0eM")
api_hash = os.environ.get("HASH", "3d5392714ba6ea6ed61b70d8d61cf4ec")
api_id = os.environ.get("ID", "4565499")
app = Client("my_bot",api_id=api_id, api_hash=api_hash,bot_token=bot_token)
# loop thread
def loopthread(message):
urls = []
for ele in message.text.split():
if "http://" in ele or "https://" in ele:
urls.append(ele)
if len(urls) == 0:
return
if bypasser.ispresent(ddllist,urls[0]):
msg = app.send_message(message.chat.id, "⚡ __generating...__", reply_to_message_id=message.id)
else:
if urls[0] in "https://olamovies" or urls[0] in "https://psa.pm/":
msg = app.send_message(message.chat.id, "🔎 __this might take some time...__", reply_to_message_id=message.id)
else:
msg = app.send_message(message.chat.id, "🔎 __bypassing...__", reply_to_message_id=message.id)
link = ""
for ele in urls:
if bypasser.ispresent(ddllist,ele):
try: temp = ddl.direct_link_generator(ele)
except Exception as e: temp = "**Error**: " + str(e)
else:
try: temp = bypasser.shortners(ele)
except Exception as e: temp = "**Error**: " + str(e)
print("bypassed:",temp)
link = link + temp + "\n\n"
try: app.edit_message_text(message.chat.id, msg.id, f'__{link}__', disable_web_page_preview=True)
except: app.edit_message_text(message.chat.id, msg.id, "__Failed to Bypass__")
# start command
@app.on_message(filters.command(["start"]))
def send_start(client: pyrogram.client.Client, message: pyrogram.types.messages_and_media.message.Message):
app.send_message(message.chat.id, f"__👋 Hi **{message.from_user.mention}**, i am Link Bypasser Bot, just send me any supported links and i will you get you results.\nCheckout /help to Read More__",
reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton("Subscribe 😘", url="https://youtube.com/@BootXTech")]]), reply_to_message_id=message.id)
# help command
@app.on_message(filters.command(["help"]))
def send_help(client: pyrogram.client.Client, message: pyrogram.types.messages_and_media.message.Message):
app.send_message(message.chat.id, HELP_TEXT, reply_to_message_id=message.id, disable_web_page_preview=True)
# links
@app.on_message(filters.text)
def receive(client: pyrogram.client.Client, message: pyrogram.types.messages_and_media.message.Message):
bypass = threading.Thread(target=lambda:loopthread(message),daemon=True)
bypass.start()
# doc thread
def docthread(message):
if message.document.file_name.endswith("dlc"):
msg = app.send_message(message.chat.id, "🔎 __bypassing...__", reply_to_message_id=message.id)
print("sent DLC file")
sess = requests.session()
file = app.download_media(message)
dlccont = open(file,"r").read()
link = bypasser.getlinks(dlccont,sess)
app.edit_message_text(message.chat.id, msg.id, f'__{link}__')
os.remove(file)
# doc
@app.on_message(filters.document)
def docfile(client: pyrogram.client.Client, message: pyrogram.types.messages_and_media.message.Message):
bypass = threading.Thread(target=lambda:docthread(message),daemon=True)
bypass.start()
# server loop
print("Bot Starting")
app.run()