MCPcopy
hub / github.com/zer0yu/CyberSecurityRSS / find_existing_feed_node

Function find_existing_feed_node

scripts/add_feed_to_tiny.py:318–331  ·  view source on GitHub ↗

Find the existing feed node and its parent for a given XML URL. Returns: Tuple of (parent, feed_node) if found, None otherwise.

(body: ET.Element, xml_url: str)

Source from the content-addressed store, hash-verified

316
317
318def find_existing_feed_node(body: ET.Element, xml_url: str) -> Optional[Tuple[ET.Element, ET.Element]]:
319 """Find the existing feed node and its parent for a given XML URL.
320
321 Returns:
322 Tuple of (parent, feed_node) if found, None otherwise.
323 """
324 wanted = normalize_url(xml_url)
325 if not wanted:
326 return None
327 for parent, rss in iter_rss_nodes(body):
328 existing = normalize_url(rss.attrib.get("xmlUrl", ""))
329 if existing == wanted:
330 return (parent, rss)
331 return None
332
333
334def add_feed_to_tree(

Callers 1

add_feed_to_treeFunction · 0.85

Calls 2

normalize_urlFunction · 0.70
iter_rss_nodesFunction · 0.70

Tested by

no test coverage detected