forked from alreadydea/ohhh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
999 lines (857 loc) · 39.3 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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
import requests
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
import pyrogram
import tgcrypto
from p_bar import progress_bar
from subprocess import getstatusoutput
import helper
import logging
import time
import glob
import aiohttp
import asyncio
import aiofiles
from pyrogram.types import User, Message
import sys
import re
import os
import io
API_ID = 24665357
API_HASH = "beb7e4b83ada668fa85f9a9b56338f1d"
BOT_TOKEN = "6700540841:AAEzEG75XEQXqfTGmIvy136zVclAUBxQKOI"
bot = Client(
"bot",
bot_token=BOT_TOKEN,
api_id=API_ID,
api_hash=API_HASH
)
@bot.on_message(filters.command(["pyro"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("**Hi Press**\n**Text** = /pro_txt\n**Top** = /pro_top\n**Vision** = /pro_vision\n**Jw** = /pro_jw\n**Olive** = /pro_olive\n**Addapdf** = /adda_pdf")
@bot.on_message(filters.command(["cancel"]))
async def cancel(_, m):
editable = await m.reply_text("Canceling All process Plz wait\n🚦🚦 Last Process Stopped 🚦🚦")
global cancel
cancel = True
await editable.edit("cancled")
return
@bot.on_message(filters.command("restart"))
async def restart_handler(_, m):
await m.reply_text("Restarted!", True)
os.execl(sys.executable, sys.executable, *sys.argv)
@bot.on_message(filters.command(["pro_txt"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text('Send TXT in **NAME : LINK** format to download')
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
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
editable = await m.reply_text(
f"Total links found are **{len(links)}**\n\nSend From where you want to download initial is **0**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
try:
arg = int(raw_text)
except:
arg = 0
editable = await m.reply_text("**Enter Title**")
input0: Message = await bot.listen(editable.chat.id)
raw_text0 = input0.text
await m.reply_text("**Enter resolution**")
input2: Message = await bot.listen(editable.chat.id)
raw_text2 = input2.text
editable = await editable.edit("Downloaded By📥")
input0: Message = await bot.listen(editable.chat.id)
raw_text0 = input0.text
editable4 = await m.reply_text(
"Now send the **Thumb url**\nEg : ```https://telegra.ph/file/d9e24878bd4aba05049a1.jpg```\n\nor Send **no**"
)
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
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 raw_text == '0':
count = 1
else:
count = int(raw_text)
try:
for i in range(arg, len(links)):
url = links[i][1]
name1 = links[i][0].replace("\t", "").replace(":", "").replace("/","").replace("+", "").replace("#", "").replace("|", "").replace("@", "").replace("*", "").replace(".", "").strip()
if raw_text2 == "144":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '256x144' in out:
ytf = f"{out['256x144']}"
elif '320x180' in out:
ytf = out['320x180']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data1 in out:
ytf = out[data1]
elif raw_text2 == "180":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '320x180' in out:
ytf = out['320x180']
elif '426x240' in out:
ytf = out['426x240']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data2 in out:
ytf = out[data2]
elif raw_text2 == "240":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '426x240' in out:
ytf = out['426x240']
elif '426x234' in out:
ytf = out['426x234']
elif '480x270' in out:
ytf = out['480x270']
elif '480x272' in out:
ytf = out['480x272']
elif '640x360' in out:
ytf = out['640x360']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data3 in out:
ytf = out[data3]
elif raw_text2 == "360":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '640x360' in out:
ytf = out['640x360']
elif '638x360' in out:
ytf = out['638x360']
elif '636x360' in out:
ytf = out['636x360']
elif '768x432' in out:
ytf = out['768x432']
elif '638x358' in out:
ytf = out['638x358']
elif '852x316' in out:
ytf = out['852x316']
elif '850x480' in out:
ytf = out['850x480']
elif '848x480' in out:
ytf = out['848x480']
elif '854x480' in out:
ytf = out['854x480']
elif '852x480' in out:
ytf = out['852x480']
elif '854x470' in out:
ytf = out['852x470']
elif '1280x720' in out:
ytf = out['1280x720']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data4 in out:
ytf = out[data4]
elif raw_text2 == "480":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '854x480' in out:
ytf = out['854x480']
elif '852x480' in out:
ytf = out['852x480']
elif '854x470' in out:
ytf = out['854x470']
elif '768x432' in out:
ytf = out['768x432']
elif '848x480' in out:
ytf = out['848x480']
elif '850x480' in out:
ytf = ['850x480']
elif '960x540' in out:
ytf = out['960x540']
elif '640x360' in out:
ytf = out['640x360']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data5 in out:
ytf = out[data5]
elif raw_text2 == "720":
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
# print(out)
if '1280x720' in out:
ytf = out['1280x720']
elif '1280x704' in out:
ytf = out['1280x704']
elif '1280x474' in out:
ytf = out['1280x474']
elif '1920x712' in out:
ytf = out['1920x712']
elif '1920x1056' in out:
ytf = out['1920x1056']
elif '854x480' in out:
ytf = out['854x480']
elif '640x360' in out:
ytf = out['640x360']
elif 'unknown' in out:
ytf = out["unknown"]
else:
for data6 in out:
ytf = out[data6]
elif "player.vimeo" in url:
if raw_text2 == '144':
ytf = 'http-240p'
elif raw_text2 == "240":
ytf = 'http-240p'
elif raw_text2 == '360':
ytf = 'http-360p'
elif raw_text2 == '480':
ytf = 'http-540p'
elif raw_text2 == '720':
ytf = 'http-720p'
else:
ytf = 'http-360p'
else:
cmd = f'yt-dlp -F "{url}"'
k = await helper.run(cmd)
out = helper.vid_info(str(k))
for dataS in out:
ytf = out[dataS]
try:
if "unknown" in out:
res = "NA"
else:
res = list(out.keys())[list(out.values()).index(ytf)]
name = f'{str(count).zfill(3)}) {name1} {res}'
except Exception:
res = "NA"
# if "youtu" in url:
# if ytf == f"'bestvideo[height<={raw_text2}][ext=mp4]+bestaudio[ext=m4a]'" or "acecwply" in url:
if "acecwply" in url:
cmd = f'yt-dlp -o "{name}.%(ext)s" -f "bestvideo[height<={raw_text2}]+bestaudio" --hls-prefer-ffmpeg --no-keep-video --remux-video mkv --no-warning "{url}"'
elif "youtu" in url:
cmd = f'yt-dlp -i -f "bestvideo[height<={raw_text2}]+bestaudio" --no-keep-video --remux-video mkv --no-warning "{url}" -o "{name}.%(ext)s"'
elif "player.vimeo" in url:
cmd = f'yt-dlp -f "{ytf}+bestaudio" --no-keep-video --remux-video mkv "{url}" -o "{name}.%(ext)s"'
elif "m3u8" or "livestream" in url:
cmd = f'yt-dlp -f "{ytf}" --no-keep-video --remux-video mkv "{url}" -o "{name}.%(ext)s"'
elif ytf == "0" or "unknown" in out:
cmd = f'yt-dlp -f "{ytf}" --no-keep-video --remux-video mkv "{url}" -o "{name}.%(ext)s"'
elif ".pdf" or "download" in url:
cmd = "pdf"
else:
cmd = f'yt-dlp -f "{ytf}+bestaudio" --hls-prefer-ffmpeg --no-keep-video --remux-video mkv "{url}" -o "{name}.%(ext)s"'
try:
Show = f"**Downloading:-**\n\n**Name :-** `{name}\nQuality - {raw_text2}`\n\n**Url :-** `{url}`"
prog = await m.reply_text(Show)
cc = f"**Name »** {name1} {res}.mkv\n**Batch »** {raw_text0}\n**Index »** {str(count).zfill(3)}"
cc1 = f"**Name »** ** {name1} {res}.pdf\n**Batch »** {raw_text0}\n**Index »** {str(count).zfill(3)}"
# await prog.delete (True)
# if cmd == "pdf" or "drive" in url:
# try:
# ka=await helper.download(url,name)
# await prog.delete (True)
# time.sleep(1)
# # await helper.send_doc(bot,m,cc,ka,cc1,prog,count,name)
# reply = await m.reply_text(f"Uploading - `{name}`")
# time.sleep(1)
# start_time = time.time()
# await m.reply_document(ka,caption=cc1)
# count+=1
# await reply.delete (True)
# time.sleep(1)
# os.remove(ka)
# time.sleep(3)
# except FloodWait as e:
# await m.reply_text(str(e))
# time.sleep(e.x)
# continue
if cmd == "pdf" or ".pdf" in url or ".pdf" in name:
try:
ka = await helper.aio(url, name)
await prog.delete(True)
time.sleep(1)
reply = await m.reply_text(f"Uploading - ```{name}```")
time.sleep(1)
start_time = time.time()
await m.reply_document(
ka,
caption=
f"**Name »** {name1} {res}.pdf\n**Batch »** {raw_text0}\n**Index »** {str(count).zfill(3)}"
)
count += 1
# time.sleep(1)
await reply.delete(True)
time.sleep(1)
os.remove(ka)
time.sleep(3)
except FloodWait as e:
await m.reply_text(str(e))
time.sleep(e.x)
continue
else:
res_file = await helper.download_video(url, cmd, name)
filename = res_file
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 ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`"
)
continue
except Exception as e:
await m.reply_text(e)
await m.reply_text("Done")
@bot.on_message(filters.command(["pro_top"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text(
"Hello Bruh **I am ankul60 Downloader Bot**. I can download videos from **text** file one by one.**\n\nLanguage** : Python**\nFramework** : Pyrogram\n\nSend **TXT** File {Name : Link}")
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
path = f"./downloads/{m.chat.id}"
try:
with open(x, "r") as f:
content = f.readlines()
os.remove(x)
# print(len(links))
except:
await m.reply_text("Invalid file input.")
os.remove(x)
return
editable = await m.reply_text(
f"Total Videos found in this Course are **{len(content)}**\n\nSend From where you want to download initial is **1**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
raw_text5 = input.document.file_name.replace(".txt", "")
await input.delete(True)
editable4 = await m.reply_text("**Send thumbnail url**\n\nor Send **no**"
)
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
thumb = input6.text
if thumb.startswith("http://") or thumb.startswith("https://"):
getstatusoutput(f"wget '{thumb}' -O 'thumb.jpg'")
thumb = "thumb.jpg"
else:
thumb == "no"
try:
for count, i in enumerate(range(int(raw_text) - 1, len(content)),
start=int(raw_text)):
name1, link = content[i].split(":", 1)
cook, url = requests.get(
f"https://api.telegramadmin.ga/gurukul/link={link}").json().values()
name = f'{str(count).zfill(3)}) {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url}`\n\n`"
prog = await m.reply_text(Show)
cc = f'**Name »** {name1}.mp4\n**Batch »** {raw_text5}\n**Index »** {str(count).zfill(3)}'
if "youtu" in url:
cmd = f'yt-dlp -f best "{url}" -o "{name}"'
elif "player.vimeo" in url:
cmd = f'yt-dlp -f "bestvideo+bestaudio" --no-keep-video "{url}" -o "{name}"'
else:
cmd = f'yt-dlp -o "{name}" --add-header "cookie: {cook}" "{url}"'
try:
res_file = await helper.download_video(url, cmd, name)
filename = res_file
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 ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`\n"
)
continue
except Exception as e:
await m.reply_text(str(e))
await m.reply_text("Done")
@bot.on_message(filters.command(["pro_vision"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("Hello Bruh **I am vision ias Downloader Bot**. ")
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
path = f"./downloads/{m.chat.id}"
try:
with open(x, "r") as f:
content = f.readlines()
os.remove(x)
# print(len(links))
except:
await m.reply_text("Invalid file input.")
os.remove(x)
return
editable = await m.reply_text(
f"Total Videos found in this Course are **{len(content)}**\n\nSend From where you want to download initial is **1**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
raw_text5 = input.document.file_name.replace(".txt", "")
await input.delete(True)
editable4 = await m.reply_text("**Send thumbnail url**\n\nor Send **no**"
)
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
thumb = input6.text
if thumb.startswith("http://") or thumb.startswith("https://"):
getstatusoutput(f"wget '{thumb}' -O 'thumb.jpg'")
thumb = "thumb.jpg"
else:
thumb == "no"
try:
for count, i in enumerate(range(int(raw_text) - 1, len(content)),
start=int(raw_text)):
name1, link = content[i].split(":", 1)
url = requests.get(
f"https://api.telegramadmin.ga/vision/link={link}").json()["link"]
cook = None
name = f'{str(count).zfill(3)}) {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url}`\n\n`"
prog = await m.reply_text(Show)
cc = f'**Name »** {name1}.mp4\n**Batch »** {raw_text5}\n**Index »** {str(count).zfill(3)}\n\n**Download BY** :- Group Admin'
if "vision" or "youtu" in url:
cmd = f'yt-dlp "{url}" -o "{name}"'
elif "player.vimeo" in url:
cmd = f'yt-dlp -f "bestvideo+bestaudio" --no-keep-video "{url}" -o "{name}"'
else:
cmd = f'yt-dlp -o "{name}" --add-header "cookie: {cook}" "{url}"'
try:
res_file = await helper.download_video(url, cmd, name)
filename = res_file
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 ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`\n"
)
continue
except Exception as e:
await m.reply_text(str(e))
await m.reply_text("Done")
@bot.on_message(filters.command(["adda_pdf"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("Hello Bruh **I am adda pdf Downloader Bot**." )
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
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
editable = await m.reply_text(
f"Total links found are **{len(links)}**\n\nSend From where you want to download initial is **0**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
try:
arg = int(raw_text)
except:
arg = 0
editable2 = await m.reply_text("**Enter Token**")
input5: Message = await bot.listen(editable.chat.id)
raw_text5 = input5.text
if raw_text == '0':
count = 1
else:
count = int(raw_text)
try:
for i in range(arg, len(links)):
url = links[i][1]
name1 = links[i][0].replace("\t", "").replace("/", "").replace(
"+",
"").replace("#", "").replace("|", "").replace("@", "").replace(
":", "").replace("*", "").replace(".", "").replace(
"'", "").replace('"', '').strip()
name = f'{str(count).zfill(3)} {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url}`"
prog = await m.reply_text(Show)
cc = f'{str(count).zfill(3)}. {name1}.pdf\n'
try:
getstatusoutput(
f'curl --http2 -X GET -H "Host:store.adda247.com" -H "user-agent:Mozilla/5.0 (Linux; Android 11; moto g(40) fusion Build/RRI31.Q1-42-51-8; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/97.0.4692.98 Mobile Safari/537.36" -H "accept:*/*" -H "x-requested-with:com.adda247.app" -H "sec-fetch-site:same-origin" -H "sec-fetch-mode:cors" -H "sec-fetch-dest:empty" -H "referer:https://store.adda247.com/build/pdf.worker.js" -H "accept-encoding:gzip, deflate" -H "accept-language:en-US,en;q=0.9" -H "cookie:cp_token={raw_text5}" "{url}" --output "{name}.pdf"'
)
await m.reply_document(f"{name}.pdf", caption=cc)
count += 1
await prog.delete(True)
os.remove(f"{name}.pdf")
time.sleep(2)
except Exception as e:
await m.reply_text(
f"{e}\nDownload Failed\n\nName : {name}\n\nLink : {url}")
continue
except Exception as e:
await m.reply_text(e)
await m.reply_text("Done")
@bot.on_message(filters.command(["pro_olive"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("Hello Bruh **I am Oliveboard Downloader Bot**.")
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
path = f"./downloads/{m.chat.id}"
try:
with open(x, "r") as f:
content = f.readlines()
os.remove(x)
# print(len(links))
except:
await m.reply_text("Invalid file input.")
os.remove(x)
return
editable = await m.reply_text(
f"Total Videos found in this Course are **{len(content)}**\n\nSend From where you want to download initial is **1**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
raw_text5 = input.document.file_name.replace(".txt", "")
await input.delete(True)
editable4 = await m.reply_text("**Send thumbnail url**\n\nor Send **no**"
)
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
thumb = input6.text
if thumb.startswith("http://") or thumb.startswith("https://"):
getstatusoutput(f"wget '{thumb}' -O 'thumb.jpg'")
thumb = "thumb.jpg"
else:
thumb == "no"
try:
for count, i in enumerate(range(int(raw_text) - 1, len(content)),
start=int(raw_text)):
name1, link = content[i].split(":", 1)
url = requests.get(
f"https://api.telegramadmin.ga/olive/link={link}").json()["m3u8"]
cook = None
name = f'{str(count).zfill(3)}) {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url}`\n\n`"
prog = await m.reply_text(Show)
cc = f'**Name »** {name1}.mp4\n**Batch »** {raw_text5}\n**Index »** {str(count).zfill(3)}\n\n**Download BY** :- Group Admin'
if "olive" or "youtu" in url:
cmd = f'yt-dlp "{url}" -o "{name}"'
elif "player.vimeo" in url:
cmd = f'yt-dlp -f "bestvideo+bestaudio" --no-keep-video "{url}" -o "{name}"'
else:
cmd = f'yt-dlp -o "{name}" --add-header "cookie: {cook}" "{url}"'
try:
res_file = await helper.download_video(url, cmd, name)
filename = res_file
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 ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`\n"
)
continue
except Exception as e:
await m.reply_text(str(e))
await m.reply_text("Done")
@bot.on_message(filters.command(["pro_jw"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("Hello Bruh **I am jw Downloader Bot**. ")
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
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
editable = await m.reply_text(
f"Total links found are **{len(links)}**\n\nSend From where you want to download initial is **0**"
)
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
try:
arg = int(raw_text)
except:
arg = 0
editable = await m.reply_text("**Enter Title**")
input0: Message = await bot.listen(editable.chat.id)
raw_text0 = input0.text
await m.reply_text("**Enter resolution**")
input2: Message = await bot.listen(editable.chat.id)
raw_text2 = input2.text
editable4 = await m.reply_text(
"Now send the **Thumb url**\nEg : ```https://telegra.ph/file/d9e24878bd4aba05049a1.jpg```\n\nor Send **no**"
)
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
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 raw_text == '0':
count = 1
else:
count = int(raw_text)
try:
for i in range(arg, len(links)):
url = links[i][1]
name1 = links[i][0].replace("\t", "").replace(":", "").replace(
"/",
"").replace("+", "").replace("#", "").replace("|", "").replace(
"@", "").replace("*", "").replace(".", "").strip()
if "jwplayer" in url:
headers = {
'Host': 'api.classplusapp.com',
'x-access-token':
'eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpZCI6MzgzNjkyMTIsIm9yZ0lkIjoyNjA1LCJ0eXBlIjoxLCJtb2JpbGUiOiI5MTcwODI3NzQyODkiLCJuYW1lIjoiQWNlIiwiZW1haWwiOm51bGwsImlzRmlyc3RMb2dpbiI6dHJ1ZSwiZGVmYXVsdExhbmd1YWdlIjpudWxsLCJjb3VudHJ5Q29kZSI6IklOIiwiaXNJbnRlcm5hdGlvbmFsIjowLCJpYXQiOjE2NDMyODE4NzcsImV4cCI6MTY0Mzg4NjY3N30.hM33P2ai6ivdzxPPfm01LAd4JWv-vnrSxGXqvCirCSpUfhhofpeqyeHPxtstXwe0',
'user-agent': 'Mobile-Android',
'app-version': '1.4.37.1',
'api-version': '18',
'device-id': '5d0d17ac8b3c9f51',
'device-details':
'2848b866799971ca_2848b8667a33216c_SDK-30',
'accept-encoding': 'gzip',
}
params = (('url', f'{url}'), )
response = requests.get(
'https://api.classplusapp.com/cams/uploader/video/jw-signed-url',
headers=headers,
params=params)
# print(response.json())
a = response.json()['url']
# print(a)
headers1 = {
'User-Agent':
'ExoPlayerDemo/1.4.37.1 (Linux;Android 11) ExoPlayerLib/2.14.1',
'Accept-Encoding': 'gzip',
'Host': 'cdn.jwplayer.com',
'Connection': 'Keep-Alive',
}
response1 = requests.get(f'{a}', headers=headers1)
url1 = (response1.text).split("\n")[2]
# url1 = b
else:
url1 = url
name = f'{str(count).zfill(3)}) {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url1}`"
prog = await m.reply_text(Show)
cc = f'**Title »** {name1}.mkv\n**Caption »** {raw_text0}\n**Index »** {str(count).zfill(3)}\n\n**Download BY** :- Group Admin'
if "pdf" in url:
cmd = f'yt-dlp -o "{name}.pdf" "{url1}"'
else:
cmd = f'yt-dlp -o "{name}.mp4" --no-keep-video --remux-video mkv "{url1}"'
try:
download_cmd = f"{cmd} -R 25 --fragment-retries 25 --external-downloader aria2c --downloader-args 'aria2c: -x 16 -j 32'"
os.system(download_cmd)
if os.path.isfile(f"{name}.mkv"):
filename = f"{name}.mkv"
elif os.path.isfile(f"{name}.mp4"):
filename = f"{name}.mp4"
elif os.path.isfile(f"{name}.pdf"):
filename = f"{name}.pdf"
# filename = f"{name}.mkv"
subprocess.run(
f'ffmpeg -i "{filename}" -ss 00:01:00 -vframes 1 "{filename}.jpg"',
shell=True)
await prog.delete(True)
reply = await m.reply_text(f"Uploading - ```{name}```")
try:
if thumb == "no":
thumbnail = f"{filename}.jpg"
else:
thumbnail = thumb
except Exception as e:
await m.reply_text(str(e))
dur = int(helper.duration(filename))
start_time = time.time()
if "pdf" in url1:
await m.reply_document(filename, caption=cc)
else:
await m.reply_video(filename,
supports_streaming=True,
height=720,
width=1280,
caption=cc,
duration=dur,
thumb=thumbnail,
progress=progress_bar,
progress_args=(reply, start_time))
count += 1
os.remove(filename)
os.remove(f"{filename}.jpg")
await reply.delete(True)
time.sleep(1)
except Exception as e:
await m.reply_text(
f"**downloading failed ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}` & `{url1}`"
)
continue
except Exception as e:
await m.reply_text(e)
await m.reply_text("Done")
@bot.on_message(filters.command(["top"]))
async def account_login(bot: Client, m: Message):
editable = await m.reply_text("Hello Bruh **I am top Downloader Bot**.")
input: Message = await bot.listen(editable.chat.id)
x = await input.download()
await input.delete(True)
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
editable = await m.reply_text(f"Total links found are **{len(links)}**\n\nSend From where you want to download initial is **0**")
input1: Message = await bot.listen(editable.chat.id)
raw_text = input1.text
try:
arg = int(raw_text)
except:
arg = 0
editable = await m.reply_text(f"**Copy Paste the App Name of which you want to download videos.**\n\n`vikramjeet`\n\n`sure60`\n\n`theoptimistclasses`")
input0: Message = await bot.listen(editable.chat.id)
raw_text0 = input0.text
editable2 = await m.reply_text("**Enter Title**")
input5: Message = await bot.listen(editable.chat.id)
raw_text5 = input5.text
editable4= await m.reply_text("Now send the **Thumb url**\nEg : ```https://telegra.ph/file/d9e24878bd4aba05049a1.jpg```\n\nor Send **no**")
input6 = message = await bot.listen(editable.chat.id)
raw_text6 = input6.text
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 raw_text =='0':
count =1
else:
count =int(raw_text)
try:
for i in range(arg, len(links)):
url = links[i][1]
name1 = links[i][0].replace("\t", "").replace("/", "").replace("+", "").replace("#", "").replace("|", "").replace("@","").replace(":","").replace("*","").replace(".","").strip()
# await m.reply_text(name +":"+ url)
# Show = f"**Downloading:-**\n\n**Name :-** ```{name}\nQuality - {raw_text2}```\n\n**Url :-** ```{url}```"
# prog = await m.reply_text(Show)
# cc = f'>> **Name :** {name}\n>> **Title :** {raw_text0}\n\n>> **Index :** {count}'
if raw_text0 in "vikramjeet" :
y= url.replace("/", "%2F")
# rout = f"https://www.toprankers.com/?route=common/ajax&mod=liveclasses&ack=getcustompolicysignedcookiecdn&stream=https%3A%2F%2Fsignedsec.toprankers.com%2Flivehttporigin%2F{y[56:-14]}%2Fmaster.m3u8"
rout =f"https://www.toprankers.com/?route=common/ajax&mod=liveclasses&ack=getcustompolicysignedcookiecdn&stream=https%3A%2F%2Fsignedsec.toprankers.com%2F{y[39:-14]}%2Fmaster.m3u8"
getstatusoutput(f'curl "{rout}" -c "cookie.txt"')
cook = "cookie.txt"
# print (rout)
# print(url)
elif raw_text0 in "sure60":
y1= url.replace("/", "%2F")
# rout = f"https://onlinetest.sure60.com/?route=common/ajax&mod=liveclasses&ack=getcustompolicysignedcookiecdn&stream=https%3A%2F%2Fvodcdn.sure60.com%2Flivehttporigin%2F{y[49:-14]}%2Fmaster.m3u8"
rout =f"https://onlinetest.sure60.com/?route=common/ajax&mod=liveclasses&ack=getcustompolicysignedcookiecdn&stream=https%3A%2F%2Fvodcdn.sure60.com%2F{y1[32:-14]}%2Fmaster.m3u8"
getstatusoutput(f'curl "{rout}" -c "cookie.txt"')
cook = "cookie.txt"
elif raw_text0 in "theoptimistclasses":
y= url.replace("/", "%2F")
rout=f"https://live.theoptimistclasses.com/?route=common/ajax&mod=liveclasses&ack=getcustompolicysignedcookiecdn&stream=https%3A%2F%2Fvodcdn.theoptimistclasses.com%2F{y[44:-14]}%2Fmaster.m3u8"
getstatusoutput(f'curl "{rout}" -c "cookie.txt"')
cook = "cookie.txt"
name = f'{str(count).zfill(3)}) {name1}'
Show = f"**Downloading:-**\n\n**Name :-** `{name}`\n\n**Url :-** `{url}`\n\n**rout** :- `{rout}`"
prog = await m.reply_text(Show)
cc = f'**Title »** {name1}.mp4\n**Caption »** {raw_text5}\n**Index »** {str(count).zfill(3)}'
cmd = f'yt-dlp -o "{name}.mp4" --cookies {cook} "{url}"'
try:
download_cmd = f"{cmd} -R 25 --fragment-retries 25 --external-downloader aria2c --downloader-args 'aria2c: -x 16 -j 32'"
os.system(download_cmd)
filename = f"{name}.mp4"
subprocess.run(f'ffmpeg -i "{filename}" -ss 00:01:00 -vframes 1 "{filename}.jpg"', shell=True)
await prog.delete (True)
reply = await m.reply_text(f"Uploading - ```{name}```")
try:
if thumb == "no":
thumbnail = f"{filename}.jpg"
else:
thumbnail = thumb
except Exception as e:
await m.reply_text(str(e))
dur = int(helper.duration(filename))
start_time = time.time()
await m.reply_video(f"{name}.mp4",supports_streaming=True,height=720,width=1280,caption=cc,duration=dur,thumb=thumbnail, progress=progress_bar,progress_args=(reply,start_time) )
count+=1
os.remove(f"{name}.mp4")
os.remove(f"{filename}.jpg")
os.remove(cook)
await reply.delete (True)
time.sleep(1)
except Exception as e:
await m.reply_text(f"**downloading failed ❌**\n{str(e)}\n**Name** - {name}\n**Link** - `{url}`\n\n**rout** :- `{rout}`")
continue
except Exception as e:
await m.reply_text(str(e))
await m.reply_text("Done")
bot.run()