Format download.py
This commit is contained in:
parent
5f7fd0ccb5
commit
43faa6139a
|
@ -7,7 +7,9 @@ import bs4
|
||||||
|
|
||||||
def matches(string, checks):
|
def matches(string, checks):
|
||||||
for check in 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 True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -44,7 +46,8 @@ try:
|
||||||
entries = [
|
entries = [
|
||||||
entry
|
entry
|
||||||
for entry in feedparser.parse(url)["entries"]
|
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.")
|
print(f"Fetched feed. Found {len(entries)} new articles.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user