Skip to content

Commit 874a897

Browse files
committed
organized file creates
1 parent cc4b141 commit 874a897

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
utils.bprint('Started')
66

7-
def check_and_write(script, name):
7+
def check_and_write(script, path):
88
match = re.search(r'"(https?://.*?)"', script)
99
url = None
1010
if match:
@@ -17,7 +17,7 @@ def check_and_write(script, name):
1717
try:
1818
response = requests.get(url)
1919
if response.status_code != 404:
20-
with open(f"valid_links {name}.txt", "a") as f:
20+
with open(f"{path}/valid_links.txt", "a") as f:
2121
f.write(script + "\n")
2222
utils.success(script)
2323
else:

main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import requests
1212
import threading
1313
import checker
14-
14+
import os
1515

1616
try:
1717
utils.os.system('taskkill /F /IM Firefox.exe')
@@ -28,6 +28,9 @@
2828

2929
list_of_scripts = []
3030

31+
os.mkdir(key.replace(' ', '-'))
32+
path = os.path.realpath(key.replace(' ', '-'))
33+
3134
def scrape_page(url):
3235
utils.bprint(f'Looking in {url}')
3336
response = requests.get(url, timeout=10)
@@ -41,7 +44,7 @@ def scrape_page(url):
4144
if script not in list_of_scripts:
4245
utils.success(f'Found script in {url} - {script}')
4346
list_of_scripts.append(script)
44-
with open(f'scripts-{key}.txt', 'a') as f:
47+
with open(f'{path}/scripts.txt', 'a') as f:
4548
f.write(script+'\n')
4649
scripts_found.append(script)
4750

@@ -112,7 +115,7 @@ def search(query):
112115

113116

114117
utils.bprint('Checking scripts')
115-
threads = [threading.Thread(target=checker.check_and_write, args=(string, key)) for string in list_of_scripts]
118+
threads = [threading.Thread(target=checker.check_and_write, args=(string, path)) for string in list_of_scripts]
116119

117120
for thread in threads:
118121
thread.start()

0 commit comments

Comments
 (0)