-
Notifications
You must be signed in to change notification settings - Fork 2
/
tsuki-wscp.py
66 lines (56 loc) · 1.79 KB
/
tsuki-wscp.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
from sys import platform, argv, exit
import subprocess
import sys
import threading
sys.path.append("/4Chan")
sys.path.append("/reddit")
sys.path.append("/twitter")
from fourchan.board import call_crawler
from reddit.heart import call_gather
from reddit.randomized import call_randomizer
from reddit.subreddit import call_subreddit
from twitter.spidermusk import call_spidermusk
def launch_threads(delay, optional_nsfw):
t1 = threading.Thread(target=call_crawler, args=(delay, optional_nsfw))
t2 = threading.Thread(target=call_gather)
t3 = threading.Thread(target=call_randomizer)
t4 = threading.Thread(target=call_subreddit)
t5 = threading.Thread(target=call_spidermusk)
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t1.join()
t2.join()
t3.join()
t4.join()
# t5.join() [UNSTABLE - If an unexpected error occurs, it might crash the whole script!]
def init_harvester():
optional_nsfw = False
if len(argv) < 3 or argv[1] != "-s":
print("Usage: python3 tsuki-wscp [-s {1-5}] [--nsfw-toggle]")
exit()
if int(argv[2]) < 1 or int(argv[2]) > 5:
print("Enter a value between 1-5")
exit()
if len(argv) == 4:
if argv[3] == "--nsfw-toggle":
delay = int(argv[2])
optional_nsfw = True
launch_threads(delay, optional_nsfw)
else:
print(f"Optional parameter is [--nsfw-toggle] not [{argv[3]}]")
exit()
elif len(argv) > 4:
print("Too many arguments")
exit()
elif len(argv) == 3:
delay = int(argv[2])
launch_threads(delay, optional_nsfw)
if platform == "linux":
bashrc_path = '.bashrc'
subprocess.call(["/usr/bin/bash", "-i", "-c", "source " + bashrc_path])
init_harvester()
else:
init_harvester()