1
0
Fork 0
mirror of synced 2024-06-29 19:41:05 +12:00

config.py: update function exclude_blacklisted(links)

This commit is contained in:
mlazana 2019-03-27 20:10:05 +02:00
parent a3705e31c6
commit 8502fa5cc3

View file

@ -34,11 +34,11 @@ from config import (
def validate_links(links):
check_links_structure(links)
links = archivable_links(links) # remove chrome://, about:, mailto: etc.
links = uniquefied_links(links) # merge/dedupe duplicate timestamps & urls
links = sorted_links(links) # deterministically sort the links based on timstamp, url
links = exclude_links(links) # exclude links that are in blacklist
links = archivable_links(links) # remove chrome://, about:, mailto: etc.
links = uniquefied_links(links) # merge/dedupe duplicate timestamps & urls
links = sorted_links(links) # deterministically sort the links based on timstamp, url
links = list(exclude_links(links)) # exclude URLs that match the blacklisted url pattern regex
if not links:
print('[X] No links found :(')
raise SystemExit(1)
@ -46,7 +46,7 @@ def validate_links(links):
for link in links:
link['title'] = unescape(link['title'].strip()) if link['title'] else None
check_link_structure(link)
return list(links)
@ -120,9 +120,8 @@ def lowest_uniq_timestamp(used_timestamps, timestamp):
return new_timestamp
def exclude_links(links):
"""exclude links that are in blacklist"""
links = [link for link in links if not URL_BLACKLIST.match(link['url'])]
return links
def exclude_blacklisted(links):
"""exclude URLs that match the blacklisted url pattern regex"""
return (link for link in links if not URL_BLACKLIST.match(link['url']))