-
Notifications
You must be signed in to change notification settings - Fork 9
/
lo.py
231 lines (221 loc) · 8.26 KB
/
lo.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
import urllib
import urllib.parse
import requests
import json
import subprocess
from pyrogram.types.messages_and_media import message
import helper
import subprocess
import datetime
import asyncio
import os
import requests
import time
from p_bar import progress_bar
import aiohttp
import tgcrypto
import aiofiles
import concurrent.futures
import subprocess
from pyrogram.types import Message
from pyrogram import Client, filters
from pyromod import listen
from pyrogram.types import Message
import tgcrypto
import asyncio
import pyrogram
from pyrogram import Client, filters, idle
from pyrogram.types.messages_and_media import message
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from pyrogram.errors import FloodWait
import time
from pyrogram.types import User, Message
from p_bar import progress_bar
import subprocess
from subprocess import getstatusoutput
import logging
import os
import sys
import re
from pyrogram import Client as bot
import cloudscraper
from logging.handlers import RotatingFileHandler
LOGGER = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
format="%(name)s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
handlers=[
RotatingFileHandler(
"log.txt", maxBytes=5000000, backupCount=10
),
logging.StreamHandler(),
],
)
def exec(cmd):
process = subprocess.run(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
output = process.stdout.decode()
error = process.stderr.decode()
if error:
#print(f'[error]\n{error}')
return f'[error]\n{error}'
if stdout:
print(f'[stdout]\n{output}')
#err = process.stdout.decode()
def pull_run(work, cmds):
with concurrent.futures.ThreadPoolExecutor(max_workers=work) as executor:
fut = executor.map(exec,cmds)
for result in results:
print(result)
bot = Client(
"CW",
bot_token= "6917084113:AAFOK37UIoEQLtY2HYu5UeF77cIF4BfGnwk",
api_id= 27097807 ,
api_hash= "9fd790a9cb1f639c921d941621d2959d"
)
@bot.on_message(filters.command(["down"]) & ~filters.edited)
async def account_login(bot: Client, m: Message):
#s = requests.Session()
global cancel
cancel = False
editable = await m.reply_text(
"Send **ID & Password** in this manner otherwise bot will not respond.\n\nSend like this:- **ID*Password**")
hdr = {
'Content-type': 'application/json',
'Accept': 'application/json',
# 'Content-Length': '72',
'Host': 'ignitedminds.live',
'Connection': 'Keep-Alive',
'User-Agent': 'Apache-HttpClient/UNAVAILABLE (java 1.4)',
}
info = {
"api_key": "kdc123",
"mobilenumber": "7618089571",
"password": "yvikash880"
}
headers = {
'Content-type': 'application/json',
'Accept': 'application/json',
'Content-Length': '72',
'Host': 'ignitedminds.live',
'Connection': 'Keep-Alive',
'User-Agent': 'Apache-HttpClient/UNAVAILABLE (java 1.4)',
}
data = '{api_key:kdc123,mobilenumber:7618089571,password:yvikash880}'
response = requests.post('https://ignitedminds.live/android/User/login_user', headers=headers, data=data)
print(response.content)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
#info["mobilenumber"] = raw_text.split("*")[0]
#info["password"] = raw_text.split("*")[1]
await input1.delete(True)
res = requests.post('https://ignitedminds.live/android/User/login_user', headers=hdr, data=info).text
print(res)
try:
output = res.json()
userid = output["id"]
token = output["connection_key"]
await editable.edit("**login Successful**")
except:
await editable.edit("**Check Back Response**")
"""
hdr = {
'Content-type': 'application/json',
'Accept': 'application/json',
# 'Content-Length': '72',
'Host': 'ignitedminds.live',
'Connection': 'Keep-Alive',
'User-Agent': 'Apache-HttpClient/UNAVAILABLE (java 1.4)',
}
data = '{api_key:kdc123,mobilenumber:7618089571,password:yvikash880}'
#response = requests.post('https://ignitedminds.live/android/User/login_user', headers=headers, data=data)
b_data = res1.json()
cool = ""
for data in b_data:
t_name =data['course_name']
FFF = "**BATCH-ID - BATCH NAME - INSTRUCTOR**"
aa = f" ```{data['id']}``` - **{data['course_name']}**\n\n"
if len(f'{cool}{aa}') > 4096:
print(aa)
cool = ""
cool += aa
await editable.edit(f'{"**You have these batches :-**"}\n\n{FFF}\n\n{cool}')
editable1 = await m.reply_text("**Now send the Batch ID to Download**")
input2 = message = await bot.listen(editable.chat.id)
raw_text2 = input2.text
await input2.delete(True)
await editable1.delete(True)
html = scraper.get("https://rgvikramjeetapi.classx.co.in/get/course_by_id?id=" + raw_text2,headers=hdr1).json()
course_title = html["data"][0]["course_name"]
scraper = cloudscraper.create_scraper()
html = scraper.get("https://rgvikramjeetapi.classx.co.in/get/allsubjectfrmlivecourseclass?courseid=" + raw_text2,headers=hdr1).content
output0 = json.loads(html)
subjID = output0["data"]
cool = ""
vj = ""
for sub in subjID:
subjid = sub["subjectid"]
idid = f"{subjid}&"
subjname = sub["subject_name"]
aa = f" ```{subjid}``` - **{subjname}**\n\n"
cool += aa
vj += idid
await editable.edit(cool)
editable1= await m.reply_text(f"Now send the **Topic IDs** to Download\n\nSend like this **1&2&3&4** so on\nor copy paste or edit **below ids** according to you :\n\n**Enter this to download full batch :-**\n```{vj}```")
input3 = message = await bot.listen(editable.chat.id)
raw_text3 = input3.text
await input3.delete(True)
await editable1.delete(True)
prog = await editable.edit("**Extracting Videos Links Please Wait 📥 **")
try:
mm = "Rgvikramjeet"
xv = raw_text3.split('&')
for y in range(0,len(xv)):
raw_text3 =xv[y]
res3 = requests.get("https://rgvikramjeetapi.classx.co.in/get/alltopicfrmlivecourseclass?courseid=" + raw_text2,"&subjectid=" + raw_text3, headers=hdr1)
b_data2 = res3.json()['data']
for data in b_data2:
t_name = (data["topic_name"])
tid = (data["topicid"])
hdr11 = {
"Host": "rgvikramjeetapi.classx.co.in",
"Client-Service": "Appx",
"Auth-Key": "appxapi",
"User-Id": userid,
"Authorization": token
}
par = {
'courseid': raw_text2,'subjectid': raw_text3,'topicid': tid,'start': '-1'}
res6 = requests.get('https://rgvikramjeetapi.classx.co.in/get/allconceptfrmlivecourseclass', params=par, headers=hdr11).json()
b_data3 = res6['data']
for data in b_data3:
cid = (data["conceptid"])
par2 = {
'courseid': raw_text2,'subjectid': raw_text3,'topicid': tid,'conceptid': cid,'start': '-1'
}
res4 = requests.get('https://rgvikramjeetapi.classx.co.in/get/livecourseclassbycoursesubtopconceptapiv3', params=par2, headers=hdr11).json()
try:
topicid = res4["data"]
for data in topicid:
tn = (data["download_link"])
tid = (data["Title"])
url = decode(tn)
mtext = f"{tid}:{url}\n"
open(f"{mm} - {course_title}.txt", "a").write(mtext)
except Exception as e:
error = f"{tid} : {e}"
await m.reply_text(error)
continue
await prog.delete(True)
await m.reply_document(f"{mm} - {course_title}.txt",caption = f"```{mm} - {course_title}```" )
os.remove(f"{mm} - {course_title}.txt")
except Exception as e:
await m.reply_text(str(e)) """
async def main():
await bot.start()
bot_info = await bot.get_me()
LOGGER.info(f"<--- @{bot_info.username} Started (c) STARKBOT --->")
await idle()
asyncio.get_event_loop().run_until_complete(main())
LOGGER.info(f"<---Bot Stopped-->")
#continue