Created
February 23, 2018 18:53
-
-
Save Lvl4Sword/7a1c8a0a7ea8c22c4da3075153e84fed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
nu_get = [] | |
print('- Downloading https://adaway.org/hosts.txt') | |
one_get = requests.get('https://adaway.org/hosts.txt') | |
print('- Done\n') | |
print('- Downloading https://hosts-file.net/ad_servers.txt') | |
two_get = requests.get('https://hosts-file.net/ad_servers.txt') | |
print('- Done\n') | |
print('- Downloading https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext') | |
three_get = requests.get('https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext') | |
print('- Done\n') | |
print('- Sorting adaway.org list') | |
for each in one_get.text.split('\n'): | |
if each not in nu_get: | |
nu_get.append(each) | |
print('- Done\n') | |
print('- Sorting hosts-file.net list') | |
for each in two_get.text.split('\n'): | |
if each not in nu_get: | |
nu_get.append(each) | |
print('- Done\n') | |
print('- Sorting pgl.yoyo.org list') | |
for each in three_get.text.split('\n'): | |
if each not in nu_get: | |
nu_get.append(each) | |
print('- Done\n') | |
with open('/home/user/Desktop/hosts_file.txt', 'a') as hosts_file: | |
for each in nu_get: | |
if each.startswith('#'): | |
pass | |
else: | |
hosts_file.write(each + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment