This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
forked from TeamHG-Memex/aquarium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-adblock.py
executable file
·47 lines (40 loc) · 2.22 KB
/
update-adblock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import requests
FILTERS = {
"easylist": "https://easylist.to/easylist/easylist.txt",
"easyprivacy": "https://easylist.to/easylist/easyprivacy.txt",
# "easyprivacy_nointernational": "https://easylist-downloads.adblockplus.org/easyprivacy_nointernational.txt",
"easylist_noadult": "https://easylist-downloads.adblockplus.org/easylist_noadult.txt",
# "antiadblockfilters": "https://easylist-downloads.adblockplus.org/antiadblockfilters.txt",
"fanboy-annoyance": "https://easylist.to/easylist/fanboy-annoyance.txt",
"fanboy-social": "https://easylist.to/easylist/fanboy-social.txt",
# "easylistgermany": "https://easylist.to/easylistgermany/easylistgermany.txt",
# "easylistitaly": "https://easylist-downloads.adblockplus.org/easylistitaly.txt",
# "easylistdutch": "https://easylist-downloads.adblockplus.org/easylistdutch.txt",
# "liste_fr": "https://easylist-downloads.adblockplus.org/liste_fr.txt",
# "easylistchina": "https://easylist-downloads.adblockplus.org/easylistchina.txt",
# "adblock_bg": "http://stanev.org/abp/adblock_bg.txt",
# "abpindo": "https://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt",
# "liste_ar": "https://liste-ar-adblock.googlecode.com/hg/Liste_AR.txt",
# "adblock_cz": "https://adblock-czechoslovaklist.googlecode.com/svn/filters.txt",
# "latvian_list": "https://gitorious.org/adblock-latvian/adblock-latvian/raw/master:lists/latvian-list.txt",
# "EasyListHebrew": "https://raw.github.com/AdBlockPlusIsrael/EasyListHebrew/master/EasyListHebrew.txt",
# "easylistlithuania": "http://margevicius.lt/easylistlithuania.txt",
}
def update(path):
if not os.path.exists(path):
os.mkdir(path)
for idx, (name, url) in enumerate(FILTERS.items(), start=1):
print("[%d/%d] [%s] downloading %s" % (idx, len(FILTERS), name, url))
try:
resp = requests.get(url, timeout=10)
except Exception as e:
print(e)
else:
fn = os.path.join(path, name+".txt")
with open(fn, 'wb') as f:
f.write(resp.content)
if __name__ == '__main__':
update(os.path.join("{{cookiecutter.folder_name}}", "filters"))