6
6
import os
7
7
import subprocess
8
8
9
-
9
+ path = "YOUR PATH HERE"
10
+ token = "YOUR TOKEN HERE"
10
11
headers3 = {
11
12
'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0' ,
12
13
'Accept' : 'application/json, text/plain, */*' ,
@@ -63,7 +64,7 @@ def upload(file_location):
63
64
else :
64
65
return "error uploading file contact admin"
65
66
66
- bot = telebot .TeleBot (' token' )
67
+ bot = telebot .TeleBot (token )
67
68
should_stop = False
68
69
@bot .message_handler (commands = ['start' ])
69
70
def start_message (message ):
@@ -76,20 +77,20 @@ def echo_all(message):
76
77
77
78
# try:
78
79
magnet_link = message .text
79
- h = lt .add_magnet_uri (ses , magnet_link , {'save_path' : '/home/nnt/torrents/ ' })
80
+ h = lt .add_magnet_uri (ses , magnet_link , {'save_path' : '/your/save/path/here ' })
80
81
s = h .status () # Initialize s before the while loop
81
- # file_directoryorfile = '/home/nnt/torrents/ ' + s.name
82
+ # file_directoryorfile = '{path} ' + s.name
82
83
while not s .is_seeding :
83
84
s = h .status ()
84
85
state_str = ['लािन मे है' , 'जाचा जा राहा है' , 'मेतादाता दोनलोद किया जा राहा है' , 'दोनलोद' , 'खतम' , 'खतम' , 'न' ]
85
86
bot .send_message (message .chat .id , 'डाउनलाेड हाे रहा है: ' + str (s .progress * 100 ) + '% ' + state_str [s .state ])
86
87
time .sleep (6 )
87
88
bot .send_message (message .chat .id , 'डाउनलाेड समाप्त हाे गया है।' )
88
89
bot .send_message (message .chat .id , 'अपलाेड कर रहे है...' )
89
- # torrent_directory = '/home/nnt/torrents/ '
90
+ # torrent_directory = '{path} '
90
91
# get only the files in the torrent directory
91
92
# run find {torrent_directory} command and get the output
92
- output = subprocess .check_output ('find /home/nnt/torrents/' , shell = True ).decode ('utf-8' ).split ("\n " )
93
+ output = subprocess .check_output ('find ' + path , shell = True ).decode ('utf-8' ).split ("\n " )
93
94
for a in range (0 ,len (output )):
94
95
try :
95
96
bot .send_message (message .chat .id , nnt .upload (output [a ]))
@@ -98,8 +99,8 @@ def echo_all(message):
98
99
bot .send_message (message .chat .id , str (a ))
99
100
100
101
# finally:
101
- # os.system("rm -rf /home/nnt/torrents/ *")
102
- os .system ("rm -rf /home/nnt/torrents/ *" )
102
+ # os.system("rm -rf {path} *")
103
+ os .system (f "rm -rf { path } *" )
103
104
@bot .message_handler (commands = ['stop' ])
104
105
def stop_Message (message ):
105
106
global should_stop
0 commit comments