-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
285 lines (234 loc) · 515 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
from pyrogram.errors.exceptions.bad_request_400 import StickerEmojiInvalid
import requests
from pytube import YouTube
import json
import subprocess
from pyrogram import Client, filters
from pyrogram.types.messages_and_media import message
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from pyrogram.errors import FloodWait
from pyromod import listen
from pyrogram.types import Message
from pyrogram import Client, filters
from p_bar import progress_bar
from subprocess import getstatusoutput
from aiohttp import ClientSession
import helper
from logger import logging
import time
import asyncio
from pyrogram.types import User, Message
import sys
import re
import os
import urllib
import urllib.parse
import tgcrypto
import cloudscraper
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
from base64 import b64encode, b64decode
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0',
'Accept': 'application/json;pk=BCpkADawqM22pe6lllPFfUMQfj47agK1PJ_Sb3P_jty9S9_yCNwT87DTolChZKFm091O3K6UCQ61qHUHBgJg811eub1T1Bqn2HHYPkGrrknKaHDgj-ofQZnWBUZJNMaKHfDFd5HoVbeQtqEgVDJHMO9Oq7q5YLIaX9MYaaDreXLDWkxzVvrng6HXTz3whbyoYzOv_4bks3_8HOqCcqkbQL6XZehh398zRw6zPjO42okH0WoX-KNmjcICMpg',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Origin': 'https://web.careerwill.com',
'Connection': 'keep-alive',
'Referer': 'https://web.careerwill.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
}
OWNER = int(os.environ.get("OWNER", 7326397503)) #replace your user id
try:
ADMINS=[]
for x in (os.environ.get("ADMINS", "7326397503 5702090016").split()): ##replace your user id (for multiple userid use white space) e.g. "123456 987456" <<- two userid ka example haa yee
# jitni userid dalni ha usti daloo ...
ADMINS.append(int(x))
except ValueError:
raise Exception("Your Admins list does not contain valid integers.")
ADMINS.append(OWNER)
bot = Client("bot",
bot_token=os.environ.get("BOT_TOKEN"),
api_id=int(os.environ.get("API_ID")),
api_hash=os.environ.get("API_HASH"))
@bot.on_message(filters.command(["start"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text(f"**👋 ʜᴇʟʟᴏ [{m.from_user.first_name}](tg://user?id={m.from_user.id})!\n\n🌟ɪ ᴀᴍ ᴛxᴛ ꜰɪʟᴇ ᴅᴏᴡʟᴏᴀᴅᴇʀ ʙᴏᴛ** \n\n❤️🔥 **ᴘʀᴇꜱꜱ /scammer ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ᴠɪᴅᴇᴏ ʙʏ ᴛxᴛ**\n\n❤️🩹 **ᴊᴏɪɴ ᴏᴜʀ <a href='https://t.me/scammer_botz'>ᴛᴇʟᴇɢʀᴀᴍ ᴄʜᴀɴɴᴇʟ</a>** \n\n💗 ᴘᴏᴡᴇʀᴇᴅ ʙʏ : 😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™~ ")
@bot.on_message(filters.command("Stop") & filters.user(ADMINS))
async def restart_handler(_, m):
await m.reply_text("🚯 **ꜱᴛᴏᴘᴘᴇᴅ** 🚯", True)
os.execl(sys.executable, sys.executable, *sys.argv)
@bot.on_message(filters.command(["scammer"]) & filters.user(ADMINS))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text('**📝 ꜱᴇɴᴅ ᴛxᴛ ꜰɪʟᴇ ꜰᴏʀ ᴅᴏᴡɴʟᴏᴀᴅ**')
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
file_name, ext = os.path.splitext(os.path.basename(x))
path = f"./downloads/{m.chat.id}"
try:
with open(x, "r") as f:
content = f.read()
content = content.split("\n")
links = []
for i in content:
links.append(i.split("://", 1))
os.remove(x)
# print(len(links)
except:
await m.reply_text("Invalid file input.")
os.remove(x)
return
await editable.edit(f"**ᴛᴏᴛᴀʟ ʟɪɴᴋꜱ ꜰᴏᴜɴᴅ ᴀʀᴇ {len(links)}**\n\nꜱᴇɴᴅ ꜰʀᴏᴍ ᴡʜᴇʀᴇ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ ɪɴɪᴛɪᴀʟ ɪꜱ **1**")
input0: Message = await bot.listen(editable.chat.id)
raw_text = input0.text
await input0.delete(True)
await editable.edit("**-═════━━━━❁━━━━═════-\nᴇɴᴛᴇʀ ʙᴀᴛᴄʜ ɴᴀᴍᴇ ᴏʀ ꜱᴇɴᴅ `/d` ꜰᴏʀ ɢʀᴀʙɪɴɢ ꜰʀᴏᴍ ᴛᴇxᴛ ꜰɪʟᴇɴᴀᴍᴇ.\n-═════━━━━❁━━━━═════-**")
input1: Message = await bot.listen(editable.chat.id)
raw_text0 = input1.text
await input1.delete(True)
if raw_text0 == '/d':
b_name = file_name
else:
b_name = raw_text0
await editable.edit("**╭━━━━❰ᴇɴᴛᴇʀ ʀᴇꜱᴏʟᴜᴛɪᴏɴ❱━➣\n┣⪼ 144\n┣⪼ 240\n┣⪼ 360\n┣⪼ 480\n┣⪼ 720\n┣⪼ 1080\n╰━━⌈⚡[😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™~]⚡⌋━━➣ **")
input2: Message = await bot.listen(editable.chat.id)
raw_text2 = input2.text
await input2.delete(True)
try:
if raw_text2 == "144":
res = "144x256"
elif raw_text2 == "240":
res = "240x426"
elif raw_text2 == "360":
res = "360x640"
elif raw_text2 == "480":
res = "480x854"
elif raw_text2 == "720":
res = "720x1280"
elif raw_text2 == "1080":
res = "1080x1920"
else:
res = "UN"
except Exception:
res = "UN"
await editable.edit("**ᴇɴᴛᴇʀ ʏᴏᴜʀ ɴᴀᴍᴇ ᴏʀ ꜱᴇɴᴅ 'de' ꜰᴏʀ ᴜꜱᴇ ᴅᴇꜰᴀᴜʟᴛ**")
input3: Message = await bot.listen(editable.chat.id)
raw_text3 = input3.text
await input3.delete(True)
if raw_text3 == 'de':
MR = credit
else:
MR = raw_text3
await editable.edit("ɴᴏᴡ ꜱᴇɴᴅ ᴛʜᴇ **ᴛʜᴜᴍʙ ᴜʀʟ**\nᴇɢ : `ʜᴛᴛᴘꜱ://ɢʀᴀᴘʜ.ᴏʀɢ/ꜰɪʟᴇ/45ꜰ562ᴅᴄ05ʙ2874ᴄ7277ᴇ.ᴊᴘɢ`\nᴏʀ ꜱᴇɴᴅ [`no`]")
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
await input6.delete(True)
await editable.delete()
thumb = input6.text
if thumb.startswith("http://") or thumb.startswith("https://"):
getstatusoutput(f"wget '{thumb}' -O 'thumb.jpg'")
thumb = "thumb.jpg"
else:
thumb == "no"
if len(links) == 1:
count = 1
else:
count = int(raw_text)
try:
for i in range(count - 1, len(links)):
V = links[i][1].replace("file/d/","uc?export=download&id=").replace("www.youtube-nocookie.com/embed", "youtu.be").replace("?modestbranding=1", "").replace("/view?usp=sharing","") # .replace("mpd","m3u8")
url = "https://" + V
if "visionias" in url:
async with ClientSession() as session:
async with session.get(url, headers={'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Language': 'en-US,en;q=0.9', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Referer': 'http://www.visionias.in/', 'Sec-Fetch-Dest': 'iframe', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'cross-site', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; RMX2121) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36', 'sec-ch-ua': '"Chromium";v="107", "Not=A?Brand";v="24"', 'sec-ch-ua-mobile': '?1', 'sec-ch-ua-platform': '"Android"',}) as resp:
text = await resp.text()
url = re.search(r"(https://.*?playlist.m3u8.*?)\"", text).group(1)
elif 'videos.classplusapp' in url:
url = requests.get(f'https://api.classplusapp.com/cams/uploader/video/jw-signed-url?url={url}', headers={'x-access-token': 'eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpZCI6MzgzNjkyMTIsIm9yZ0lkIjoyNjA1LCJ0eXBlIjoxLCJtb2JpbGUiOiI5MTcwODI3NzQyODkiLCJuYW1lIjoiQWNlIiwiZW1haWwiOm51bGwsImlzRmlyc3RMb2dpbiI6dHJ1ZSwiZGVmYXVsdExhbmd1YWdlIjpudWxsLCJjb3VudHJ5Q29kZSI6IklOIiwiaXNJbnRlcm5hdGlvbmFsIjowLCJpYXQiOjE2NDMyODE4NzcsImV4cCI6MTY0Mzg4NjY3N30.hM33P2ai6ivdzxPPfm01LAd4JWv-vnrSxGXqvCirCSpUfhhofpeqyeHPxtstXwe0'}).json()['url']
# elif 'd26g5bnklkwsh4.cloudfront.net' in url or 'd1d34p8vz63oiq.cloudfront.net' in url:
# id = url.split("/")[-2]
# url = "https://pw.jarviis.workers.dev?v=https://d1d34p8vz63oiq.cloudfront.net/"+id+"/master.mpd&quality="+ raw_text2
elif '/master.mpd' in url:
id = url.split("/")[-2]
url = "https://d26g5bnklkwsh4.cloudfront.net/" + id + "/main.m3u8"
elif "/khansirvod4" and "akamaized" in url:
url = url.replace(url.split("/")[-1], raw_text2+".m3u8")
elif "edge.api.brightcove.com" in url:
link = url.split("/")[-1]
urlb = url.replace("/"+link, " ")
bcov = link.replace("master.m3u8?", " ")
r= requests.get('urlb', headers=headers)
lin = r.json()['sources'][5]
fin = lin['src']
url = fnl+"&"+bcov
elif "jw-prod" in url:
url = url.replace(url.split("/")[-1], res+'.mp4')
name1 = links[i][0].replace("\t", "").replace(":", "").replace("/", "").replace("+", "").replace("#", "").replace("|", "").replace("@", "").replace("*", "").replace(".", "").replace("https", "").replace("http", "").strip()
name = f'{str(count).zfill(3)}) 😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™~ {name1[:60]}'
if "youtube" in url:
ytf = f"b[height<={raw_text2}][ext=mp4]/bv[height<={raw_text2}][ext=mp4]+ba[ext=m4a]/b[ext=mp4]"
else:
ytf = f"b[height<={raw_text2}]/bv[height<={raw_text2}]+ba/b/bv+ba"
if "jw-prod" in url:
cmd = f'yt-dlp -o "{name}.mp4" "{url}"'
else:
cmd = f'yt-dlp -f "{ytf}" "{url}" -o "{name}.mp4"'
try:
cc = f'**[ 🎬 ] Vid ID : {str(count).zfill(3)}**\n**Video Title** : {name1}({res})**[😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™~]**.mp4\n\n**Batch Name** : {b_name}\n\n@ebooks_pdf_sarkari\n**𝐄𝐱𝐭𝐫𝐚𝐜𝐭𝐞𝐝 𝐁𝐲 ➤ {MR}**\n\n'
cc1 = f'**[ 📕 ] Pdf ID : {str(count).zfill(3)}**\n**Video Title** : {name1} **[😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™~]**.pdf \n\n**Batch Name** : {b_name}\n\n@ebooks_pdf_sarkari\n**𝐄𝐱𝐭𝐫𝐚𝐜𝐭𝐞𝐝 𝐁𝐲 ➤ {MR}**\n'
if "drive" in url:
try:
ka = await helper.download(url, name)
copy = await bot.send_document(chat_id=m.chat.id,document=ka, caption=cc1)
count+=1
os.remove(ka)
time.sleep(1)
except FloodWait as e:
await m.reply_text(str(e))
time.sleep(e.x)
continue
elif ".pdf" in url:
try:
cmd = f'yt-dlp -o "{name}.pdf" "{url}"'
download_cmd = f"{cmd} -R 25 --fragment-retries 25"
os.system(download_cmd)
copy = await bot.send_document(chat_id=m.chat.id, document=f'{name}.pdf', caption=cc1)
count +=1
os.remove(f'{name}.pdf')
except FloodWait as e:
await m.reply_text(str(e))
time.sleep(e.x)
continue
# elif "videos" in url:
# try:
# Show1 = f"2nd option is working\n**⥥ 📥 DOWNLODING 📥 :-**\n\n**📝Name »** `{name}\n❄𝐐𝐮𝐚𝐥𝐢𝐭𝐲 » {raw_text2}`\n\n**Url :-** `Kya karega URL dekhke ☠️☠️`\n\n **Bot made by [😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™]**"
# prog = await m.reply_text(Show1)
# og_file = await helper.down_lec(url, name)
# filename = og_file
# await prog.delete(True)
# await helper.send_vid(bot, m, cc, filename, thumb, name, prog)
# count += 1
# except FloodWait as e:
# await m.reply_text(str(e))
# time.sleep(1)
# continue
else:
Show = f"**⚡Dᴏᴡɴʟᴏᴀᴅ Sᴛᴀʀᴛᴇᴅ....**\n\n**📚❰Name❱** `{name}\n🍁𝐐𝐮𝐚𝐥𝐢𝐭𝐲 » {raw_text2}`\n🌿**Url**» `Kya karega URL dekhke ☠️☠️`\n\n **ʙᴏᴛ ᴍᴀᴅᴇ ʙʏ [😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™]**\n**═════━━━━❁━━━━═════ **"
prog = await m.reply_text(Show)
res_file = await helper.download_video(url, cmd, name)
filename = res_file
await prog.delete(True)
await helper.send_vid(bot, m, cc, filename, thumb, name, prog)
count += 1
time.sleep(1)
except Exception as e:
await m.reply_text(
f"**downloading failed [😎𝖘cᾰ𝗺𝗺ⲉ𝗿:)™]**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`"
)
except Exception as e:
await m.reply_text(e)
await m.reply_text("**ᴅᴏɴᴇ ʙᴏꜱꜱ🌟**")
bot.run()