Format download.py

This commit is contained in:
Samuel Sloniker 2022-11-24 20:57:14 -08:00
parent 5f7fd0ccb5
commit 43faa6139a
Signed by: kj7rrv
GPG Key ID: 1BB4029E66285A62

View File

@ -7,7 +7,9 @@ import bs4
def matches(string, checks):
for check in checks:
if check["type"] == "startswith" and string.startswith(check["pattern"]):
if check["type"] == "startswith" and string.startswith(
check["pattern"]
):
return True
return False
@ -44,7 +46,8 @@ try:
entries = [
entry
for entry in feedparser.parse(url)["entries"]
if not entry["link"] in known and not matches(entry["link"], config.get("exclude", []))
if not entry["link"] in known
and not matches(entry["link"], config.get("exclude", []))
]
print(f"Fetched feed. Found {len(entries)} new articles.")