Skip to content

Instantly share code, notes, and snippets.

@Lvl4Sword
Created February 23, 2018 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lvl4Sword/7a1c8a0a7ea8c22c4da3075153e84fed to your computer and use it in GitHub Desktop.
Save Lvl4Sword/7a1c8a0a7ea8c22c4da3075153e84fed to your computer and use it in GitHub Desktop.
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