deploy: filter global navs from RSS news cache
This commit is contained in:
@@ -898,6 +898,14 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Filter out short noise paragraphs (ads, nav links)
|
# Filter out short noise paragraphs (ads, nav links)
|
||||||
if len(p_clean) > 85 and not p_clean.startswith("Follow ") and not p_clean.startswith("Read more") and not "click here" in p_clean.lower() and not "twitter" in p_clean.lower():
|
if len(p_clean) > 85 and not p_clean.startswith("Follow ") and not p_clean.startswith("Read more") and not "click here" in p_clean.lower() and not "twitter" in p_clean.lower():
|
||||||
|
# Standard library blocklist to discard site global header/footer navigation items
|
||||||
|
ignore_terms = [
|
||||||
|
"British Broadcasting Corporation", "Watch Live", "HomeNewsSport",
|
||||||
|
"Special Series", "Up First", "All Up First Stories", "hide caption",
|
||||||
|
"LISTEN & FOLLOW", "Morning Edition", "Morning news brief", "Podcast"
|
||||||
|
]
|
||||||
|
if any(term in p_clean for term in ignore_terms):
|
||||||
|
continue
|
||||||
paragraphs.append(p_clean)
|
paragraphs.append(p_clean)
|
||||||
|
|
||||||
# Keep top 8 substantial paragraphs
|
# Keep top 8 substantial paragraphs
|
||||||
|
|||||||
Reference in New Issue
Block a user