Update 'crawler.py'

This commit is contained in:
Kale 2021-08-02 08:30:49 -07:00
parent 15a185e74b
commit 9f3e40a474
No known key found for this signature in database
GPG Key ID: F8A6CE83F1274467

View File

@ -68,6 +68,20 @@ def killingdup(duplicated_file):
print("++ successful!")
f.close()
def excluded(excluded_file ,incoming):
with open(excluded ,'r') as f:
exclude = f.read().split()
with open(incoming ,'r') as f:
lines = f.read().splitlines() # read lines
with open(output ,'w') as f:
for line in lines:
if line.strip() and not line in exclude and not line.startswith(';'):
f.write('\n'.join([line + ' CNAME .\n']))
elif line.startswith((';','$','@',' IN')):
f.write('\n'.join([line + '\n']))
elif not line.strip():
f.write('\n'.join([line + '\n']))
if __name__ == "__main__":
download_filters('https://filters.kylz.nl/RPZ/someonewhocares/rpz.txt','test.txt')
filtering('test.txt')