feeds/update.py: fix sources which have null
description
This commit is contained in:
@@ -36,7 +36,7 @@ def clean_item(item: dict) -> dict:
|
|||||||
"url", # used by <hosts/common/feeds.nix> (and many others)
|
"url", # used by <hosts/common/feeds.nix> (and many others)
|
||||||
"velocity", # used by <hosts/common/feeds.nix>
|
"velocity", # used by <hosts/common/feeds.nix>
|
||||||
# "version",
|
# "version",
|
||||||
]
|
] and item[k] is not None
|
||||||
}
|
}
|
||||||
# clean up characters for better printability
|
# clean up characters for better printability
|
||||||
for k in "title", "site_name", "description":
|
for k in "title", "site_name", "description":
|
||||||
@@ -89,13 +89,13 @@ def main():
|
|||||||
serialized = [item.serialize() for item in items]
|
serialized = [item.serialize() for item in items]
|
||||||
serialized = [clean_item(s) for s in serialized]
|
serialized = [clean_item(s) for s in serialized]
|
||||||
for item in serialized:
|
for item in serialized:
|
||||||
print(json.dumps(item, sort_keys=True, indent=2))
|
print(json.dumps(item, sort_keys=True, indent=2))
|
||||||
|
|
||||||
# save the best feed to disk
|
# save the best feed to disk
|
||||||
keep = select_feed(serialized, prefer_podcast=prefer_podcast)
|
keep = select_feed(serialized, prefer_podcast=prefer_podcast)
|
||||||
results = json.dumps(keep, sort_keys=True, indent=2)
|
results = json.dumps(keep, sort_keys=True, indent=2)
|
||||||
with open(json_path, "w") as out:
|
with open(json_path, "w") as out:
|
||||||
out.write(results)
|
out.write(results)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user