forked from useragents/Proxyless-Spotify-Follow-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
62 lines (51 loc) · 1.62 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
from follow_bot import spotify
import threading
import os
from time import sleep
from colorama import Fore
lock = threading.Lock()
proxies = []
proxy_counter, counter = 0, 0
spotify_profile = str(input("Link to Profile or Playlist: "))
threads = int(input("\nThreads: "))
def load_proxies():
if not os.path.exists("proxies.txt"):
with open("proxies.txt", "x") as f:
print("Created proxies.txt")
os._exit(0)
with open("proxies.txt", "r", encoding = "UTF-8") as f:
for line in f.readlines():
line = line.replace("\n", "")
proxies.append(line)
if not len(proxies):
print("\nNo proxies in proxies.txt")
os._exit(0)
print("\n[1] Proxies\n[2] Proxyless")
option = int(input("\n> "))
if option == 1:
load_proxies()
def safe_print(arg):
lock.acquire()
print(arg)
lock.release()
def thread_starter():
global counter
if option == 1:
obj = spotify(spotify_profile, proxies[proxy_counter])
else:
obj = spotify(spotify_profile)
result, error = obj.follow()
if result is True:
counter += 1
safe_print(Fore.GREEN+"Success "+Fore.WHITE+"Followed {}".format(counter)+" times")
else:
safe_print(Fore.RED+f"Error: {Fore.WHITE+error}")
while True:
if threading.active_count() <= threads:
try:
threading.Thread(target = thread_starter).start()
proxy_counter += 1
except:
pass
if len(proxies) <= proxy_counter: #Loops through proxy file
proxy_counter = 0