diff --git a/__pycache__/crawler.cpython-37.pyc b/__pycache__/crawler.cpython-37.pyc deleted file mode 100644 index c7c0d06..0000000 Binary files a/__pycache__/crawler.cpython-37.pyc and /dev/null differ diff --git a/crawler.py b/crawler.py index 903637a..1ecd0a3 100644 --- a/crawler.py +++ b/crawler.py @@ -5,14 +5,9 @@ import re print('starting . . . ') -try: - os.remove(input) -except OSError: - pass - -def download_filters(url,input): +def download_filters(url,incoming): try: - os.remove(input) + os.remove(incoming) except OSError: pass @@ -20,7 +15,7 @@ def download_filters(url,input): get = requests.get(url) if get.status_code == requests.codes.ok: - with open(input, 'ab') as f: + with open(incoming, 'ab') as f: for data in get: f.write(data) return url @@ -72,7 +67,8 @@ def killingdup(duplicated_file): print("++ successful!") f.close() -print('process completed.') -print('Location of your file is ' + input) - -exit() \ No newline at end of file +if __name__ == "__main__": + download_filters('https://filters.kylz.nl/RPZ/someonewhocares/rpz.txt','test.txt') + filtering('test.txt') + filteringcon('test.txt') + killingdup('test.txt') \ No newline at end of file diff --git a/maker_domains.py b/maker_domains.py index bf6b489..4584ccb 100644 --- a/maker_domains.py +++ b/maker_domains.py @@ -3,9 +3,6 @@ import sys import datetime import pytz - -excluded = sys.argv[1] -input = sys.argv[2] UTC = pytz.utc date = datetime.datetime.now(UTC) @@ -17,12 +14,12 @@ def linecounter(): ankstanop = linecounter() -def domainsbuilding(): +def domainsbuilding(excluded ,incoming): with open(excluded ,'r') as f: exclude = f.read().split() - with open(input ,'r') as f: + with open(incoming ,'r') as f: lines = f.read().splitlines() # read lines - with open(input ,'w') as f: + with open(incoming ,'w') as f: f.write('# Title : Minoplhy Personal Blocklist\n') f.write('# Description : My Very Personal DNS Blocklist plus crawling from the source\n') f.write('# Source : Resources/Source.txt\n') @@ -39,5 +36,5 @@ def domainsbuilding(): f.write('\n'.join([line + '\n'])) f.close() -domainsbuilding() -exit() \ No newline at end of file +if __name__ == "__main__": + domainsbuilding(None,'test.txt') \ No newline at end of file diff --git a/maker_rpz.py b/maker_rpz.py index 4af18da..457188f 100644 --- a/maker_rpz.py +++ b/maker_rpz.py @@ -3,10 +3,6 @@ import sys import datetime import pytz - -excluded = sys.argv[1] -input = sys.argv[2] -output = sys.argv[3] UTC = pytz.utc date = datetime.datetime.now(UTC) @@ -16,7 +12,7 @@ def linecounter(): pass return i + 1 -def RPZbuilding(): +def RPZbuilding(excluded,input,output): with open(excluded ,'r') as f: exclude = f.read().split() with open(input ,'r') as f: @@ -40,4 +36,6 @@ def RPZbuilding(): if not line.strip(): f.write('\n'.join([line + '\n'])) f.close() -exit() \ No newline at end of file + + if __name__ == "__main__": + RPZbuilding(None,'test.txt','test.rpz') \ No newline at end of file