MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _parse_rss_items

Function _parse_rss_items

Scripts/ButSystem.py:10432–10498  ·  view source on GitHub ↗

Parse RSS/Atom bytes into a list of items: {title,url,source,topic_key,topic,published}.

(xml_bytes: bytes, source: str, topic_key: str, topic_label: str, is_google: bool)

Source from the content-addressed store, hash-verified

10430
10431This docstring was expanded to make future maintenance easier.
10432
10433Returns:
10434 Varies.
10435"""
10436 def child_path(rel, name):
10437 """child_path.
10438
10439Route handler or application helper.
10440
10441This docstring was expanded to make future maintenance easier.
10442
10443Args:
10444 rel: Parameter.
10445 name: Parameter.
10446
10447Returns:
10448 Varies.
10449"""
10450 rel = (rel or "").strip("/")
10451 return f"{rel}/{name}" if rel else name
10452 u = current_user()
10453 prefs = get_user_prefs(u) if u else dict(DEFAULT_PREFS)
10454 but_css = BUT_CSS + prefs_css(prefs)
10455 try:
10456 story_users = _story_active_usernames() if u else set()
10457 except Exception:
10458 story_users = set()
10459 def has_active_story(username):
10460 try:
10461 return bool(username and (username in story_users))
10462 except Exception:
10463 return False
10464 return dict(
10465 but_css=but_css,
10466 user=u,
10467 user_prefs=prefs,
10468 my_profile=getattr(g, "my_profile", None),
10469 child_path=child_path,
10470 request=request,
10471 is_admin=user_is_admin(current_user()),
10472 has_active_story=has_active_story,
10473 story_active_users=story_users,
10474 log_path=LOG_PATH,
10475 app_data_dir=BASE_DIR,
10476 watermark=WATERMARK,
10477 notifications=getattr(g, "notifs", None),
10478 )
10479
10480@app.before_request
10481def _attach_profile_and_presence():
10482 # Presence is scoped by the host used to reach the app (local vs cloudflared vs tor).
10483 """_attach_profile_and_presence.
10484
10485Internal helper function.
10486
10487This docstring was expanded to make future maintenance easier.
10488
10489Returns:

Callers 1

_fetch_news_uncachedFunction · 0.70

Calls 2

txtFunction · 0.70
push_itemFunction · 0.70

Tested by

no test coverage detected