in make_manifest.py [0:0]
def collect_icons_for_top_sites(topsitesfile, extrafile, count):
results = []
extra_domains = []
if extrafile:
# Add extra domains if extra file is provided by user
extra_domains = extra_sites(extrafile)
for rank, hostname in top_sites(topsitesfile, count) + extra_domains:
# Skip NSFW and blacklisted sites
if is_nsfw(hostname) or hostname in DOMAIN_EXCLUSION_LIST:
continue
url = 'https://{hostname}'.format(hostname=hostname)
icons = fetch_icons(url)
if len(icons) == 0 and 'www.' not in hostname:
# Retry with www. in the hostname as some domains require it explicitly.
url = f"https://www.{hostname}"
icons = fetch_icons(url)
best_icon_url, best_icon_width = get_best_icon(icons)
results.append({
'hostname': hostname,
'url': url,
'icons': icons,
'rank': rank,
'best_icon_url': best_icon_url,
'best_icon_width': best_icon_width
})
logging.info('Done fetching icons')
return results