Skip to content

Commit 25bea69

Browse files
committed
change site colors; remove aws rank code
1 parent eb4ecd4 commit 25bea69

File tree

3 files changed

+26
-65
lines changed

3 files changed

+26
-65
lines changed

Pipfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ verify_ssl = true
55

66
[packages]
77
jinja2 = "*"
8-
myawis = "*"
98
geoip2 = "*"
109
whois = "*"
1110

build.py

+2-40
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
import geoip2.database
1616
import urllib.request
1717
import whois
18-
import check
19-
20-
from xml.etree import ElementTree
2118

2219
import jinja2
23-
import myawis
2420

2521

2622
HATE_SITES_CSV_DEFAULT_PATH = 'hate-sites.csv'
@@ -36,35 +32,6 @@
3632
}
3733

3834

39-
def site_rank(site: str) -> typing.Optional[int]:
40-
while True:
41-
obj = myawis.CallAwis(args.aws_access_key_id, args.aws_secret_access_key)
42-
try:
43-
urlinfo = obj.urlinfo(site)
44-
break
45-
except requests.exceptions.ConnectionError:
46-
log_error(site, "AWIS connection error, trying again")
47-
try:
48-
tree = ElementTree.fromstring(str(urlinfo))
49-
except ElementTree.ParseError:
50-
log_error(site, "Could not retrieve rank")
51-
return None
52-
results = tree.findall(
53-
'.//aws:TrafficData/aws:Rank',
54-
{'aws': "http://awis.amazonaws.com/doc/2005-07-11"}
55-
)
56-
if not results:
57-
log_error(site, 'Could not find rank')
58-
return None
59-
rank = tree.findall(
60-
'.//aws:TrafficData/aws:Rank',
61-
{'aws': "http://awis.amazonaws.com/doc/2005-07-11"}
62-
)[0].text
63-
log_info(site, f"Found site rank: {rank}")
64-
# TODO fetch `aws:ContributingSubdomain`
65-
return int(rank) if rank else None
66-
67-
6835
def log_info(site: str, s: str):
6936
logging.info(f"{site} - {s}")
7037

@@ -127,14 +94,11 @@ def build_isps_data(limit=None):
12794
if isp is None:
12895
continue
12996

130-
rank = site_rank(site)
131-
13297
hate_site_response = HateSiteLoader(domain=site).load()
13398
is_site_up = isinstance(
13499
HateSiteResponseAnalyzer(response=hate_site_response, page_string=page_string).analyze(),
135100
HateSiteResponseSiteUp
136101
)
137-
print(f"site up: {is_site_up}")
138102

139103
if classification != 'splc':
140104
classification = None
@@ -192,7 +156,7 @@ class HateSiteResponsePageStringNotFound:
192156
pass
193157

194158

195-
class HateSiteReponseSiteDown(typing.NamedTuple):
159+
class HateSiteResponseSiteDown(typing.NamedTuple):
196160
status_code: typing.Optional[int]
197161
reason: str
198162

@@ -201,7 +165,7 @@ class HateSiteResponseAnalyzer(typing.NamedTuple):
201165
response: typing.Union[HateSiteResponse, HateSiteErrorResponse]
202166
page_string: str
203167

204-
def analyze(self) -> typing.Union[HateSiteResponseSiteUp, HateSiteResponsePageStringNotFound, HateSiteReponseSiteDown]:
168+
def analyze(self) -> typing.Union[HateSiteResponseSiteUp, HateSiteResponsePageStringNotFound, HateSiteResponseSiteDown]:
205169
if isinstance(self.response, HateSiteResponse):
206170
if self.page_string.encode() in self.response.body:
207171
return HateSiteResponseSiteUp()
@@ -237,8 +201,6 @@ def render(limit=None):
237201

238202
if __name__ == "__main__":
239203
parser = argparse.ArgumentParser()
240-
parser.add_argument('aws_access_key_id')
241-
parser.add_argument('aws_secret_access_key')
242204
parser.add_argument('--hate-sites-csv-path', default=HATE_SITES_CSV_DEFAULT_PATH)
243205
parser.add_argument('--log', action='store_true')
244206
parser.add_argument('--limit', type=int, help='Limit the number of sites to process')

templates/base.html.j2

+24-24
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@
3232
}
3333
3434
/* variables */
35-
/* https://paletton.com/#uid=73Y1U0kcEbc8EmTaIhAiWa8o57L */
35+
/* https://paletton.com/#uid=73Y1U0kcrbw8knSaNimj9aqoB7L */
3636
:root {
37-
--color-primary-0: #292A3E;
38-
--color-primary-1: #61637F;
39-
--color-primary-2: #454761;
40-
--color-primary-3: #1C1D38;
41-
--color-primary-4: #0F112B;
42-
43-
--color-secondary-1-0: #594036;
44-
--color-secondary-1-1: #B69285;
45-
--color-secondary-1-2: #8C6A5D;
46-
--color-secondary-1-3: #512E21;
47-
--color-secondary-1-4: #3E1C0F;
48-
49-
--color-secondary-2-0: #253E33;
50-
--color-secondary-2-1: #5C7E6F;
51-
--color-secondary-2-2: #406152;
52-
--color-secondary-2-3: #173829;
53-
--color-secondary-2-4: #0B2B1C;
54-
55-
--color-complement-0: #595036;
56-
--color-complement-1: #B6AA85;
57-
--color-complement-2: #8C805D;
58-
--color-complement-3: #514421;
59-
--color-complement-4: #3E320F;
37+
--color-primary-0: #2B2C40;
38+
--color-primary-1: #676884;
39+
--color-primary-2: #484A66;
40+
--color-primary-3: #1C1E3A;
41+
--color-primary-4: #0F102B;
42+
43+
--color-secondary-1-0: #5C4238;
44+
--color-secondary-1-1: #BE9A8D;
45+
--color-secondary-1-2: #926E61;
46+
--color-secondary-1-3: #532F21;
47+
--color-secondary-1-4: #3E1B0E;
48+
49+
--color-secondary-2-0: #273F34;
50+
--color-secondary-2-1: #618374;
51+
--color-secondary-2-2: #436556;
52+
--color-secondary-2-3: #17392A;
53+
--color-secondary-2-4: #0A2B1C;
54+
55+
--color-complement-0: #5C5238;
56+
--color-complement-1: #BEB18D;
57+
--color-complement-2: #928561;
58+
--color-complement-3: #534621;
59+
--color-complement-4: #3E310E;
6060
}
6161
6262
/* margin */

0 commit comments

Comments
 (0)