mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-07-01 02:36:52 +00:00
Create and fill a table of sources used for the base hosts file.
This commit is contained in:
@@ -14,17 +14,14 @@ Host file recipe | Readme | Raw hosts | hosts (.zip) | Unique domains
|
|||||||
|
|
||||||
**Expectation**: These unified hosts files should serve all devices, regardless of OS.
|
**Expectation**: These unified hosts files should serve all devices, regardless of OS.
|
||||||
|
|
||||||
## Sources of hosts data unified here
|
## Sources of hosts data unified in this variant
|
||||||
|
|
||||||
Updated `hosts` files from the following locations are always unified and included:
|
Updated `hosts` files from the following locations are always unified and included:
|
||||||
|
|
||||||
* The [Adaway hosts file](http://adaway.org/hosts.txt), updated regularly.
|
Host file source | Description | Home page | Raw hosts | Update frequency
|
||||||
* MVPs.org Hosts file at [http://winhelp2002.mvps.org/hosts.htm](http://winhelp2002.mvps.org/hosts.htm), updated
|
-----------------|-------------|:---------:|:---------:|:-------:
|
||||||
monthly, or thereabouts.
|
@SOURCEROWS@
|
||||||
* Dan Pollock at [http://someonewhocares.org/hosts/](http://someonewhocares.org/hosts/) updated regularly.
|
|
||||||
* Malware Domain List at [http://www.malwaredomainlist.com/](http://www.malwaredomainlist.com/), updated regularly.
|
|
||||||
* Peter Lowe at [http://pgl.yoyo.org/adservers/](http://pgl.yoyo.org/adservers/), updated regularly.
|
|
||||||
* My own small list in raw form [here](https://raw.github.com/StevenBlack/hosts/master/data/StevenBlack/hosts).
|
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
The unified hosts file is extensible. You manage extensions by curating the `extensions/` folder tree.
|
The unified hosts file is extensible. You manage extensions by curating the `extensions/` folder tree.
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ Python3 = sys.version_info >= (3,0)
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
master = "https://github.com/StevenBlack/hosts/blob/master/"
|
s = Template('${description} | [Readme](https://github.com/StevenBlack/hosts/blob/master/${location}readme.md) | [link](https://raw.githubusercontent.com/StevenBlack/hosts/master/${location}hosts) | [link](https://raw.githubusercontent.com/StevenBlack/hosts/master/${location}hosts.zip) | ${fmtentries}')
|
||||||
raw = "https://raw.githubusercontent.com/StevenBlack/hosts/master/"
|
|
||||||
s = Template('${description} | [Readme](${master}${location}readme.md) | [link](${raw}${location}hosts) | [link](${raw}${location}hosts.zip) | ${fmtentries}')
|
|
||||||
|
|
||||||
with open(README_DATA_FILENAME, 'r') as f:
|
with open(README_DATA_FILENAME, 'r') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
@@ -51,12 +49,29 @@ def main():
|
|||||||
|
|
||||||
tocRows += s.substitute(data[key]) + "\n"
|
tocRows += s.substitute(data[key]) + "\n"
|
||||||
|
|
||||||
|
rowdefaults = {
|
||||||
|
"name": "",
|
||||||
|
"description": "",
|
||||||
|
"homeurl": "",
|
||||||
|
"frequency": "",
|
||||||
|
"issues": "",
|
||||||
|
"url": ""}
|
||||||
|
|
||||||
|
t = Template('${name} | ${description} |[link](${homeurl}) | [raw](${url}) | ${frequency} ')
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
extensions = key.replace( "-", ", ")
|
extensions = key.replace( "-", ", ")
|
||||||
extensionsStr = "* Extensions: **" + extensions + "**."
|
extensionsStr = "* Extensions: **" + extensions + "**."
|
||||||
extensionsHeader = "with "+ extensions + " extensions"
|
extensionsHeader = "with "+ extensions + " extensions"
|
||||||
|
|
||||||
|
sourceRows = ""
|
||||||
|
sourceList = data[key]["sourcesdata"]
|
||||||
|
for source in sourceList:
|
||||||
|
thisrow = {}
|
||||||
|
thisrow.update(rowdefaults)
|
||||||
|
thisrow.update(source)
|
||||||
|
sourceRows += t.substitute(thisrow) + "\n"
|
||||||
|
|
||||||
with open(os.path.join(data[key]["location"],README_FILENAME), "wt") as out:
|
with open(os.path.join(data[key]["location"],README_FILENAME), "wt") as out:
|
||||||
for line in open(README_TEMPLATE):
|
for line in open(README_TEMPLATE):
|
||||||
line = line.replace( '@GEN_DATE@', time.strftime("%B %d %Y", time.gmtime()))
|
line = line.replace( '@GEN_DATE@', time.strftime("%B %d %Y", time.gmtime()))
|
||||||
@@ -65,6 +80,7 @@ def main():
|
|||||||
line = line.replace( '@NUM_ENTRIES@', "{:,}".format(data[key]["entries"]))
|
line = line.replace( '@NUM_ENTRIES@', "{:,}".format(data[key]["entries"]))
|
||||||
line = line.replace( '@SUBFOLDER@',os.path.join(data[key]["location"], ''))
|
line = line.replace( '@SUBFOLDER@',os.path.join(data[key]["location"], ''))
|
||||||
line = line.replace( '@TOCROWS@', tocRows )
|
line = line.replace( '@TOCROWS@', tocRows )
|
||||||
|
line = line.replace( '@SOURCEROWS@', sourceRows )
|
||||||
out.write( line )
|
out.write( line )
|
||||||
|
|
||||||
def cmp_keys(item):
|
def cmp_keys(item):
|
||||||
|
|||||||
Reference in New Issue
Block a user