File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55utils .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 :
Original file line number Diff line number Diff line change 1111import requests
1212import threading
1313import checker
14-
14+ import os
1515
1616try :
1717 utils .os .system ('taskkill /F /IM Firefox.exe' )
2828
2929list_of_scripts = []
3030
31+ os .mkdir (key .replace (' ' , '-' ))
32+ path = os .path .realpath (key .replace (' ' , '-' ))
33+
3134def 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
114117utils .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
117120for thread in threads :
118121 thread .start ()
You can’t perform that action at this time.
0 commit comments