(node: ET.Element, *paths: str)
| 152 | |
| 153 | |
| 154 | def _xml_text(node: ET.Element, *paths: str) -> str: |
| 155 | namespaces = { |
| 156 | "atom": "http://www.w3.org/2005/Atom", |
| 157 | "dc": "http://purl.org/dc/elements/1.1/", |
| 158 | } |
| 159 | for path in paths: |
| 160 | try: |
| 161 | found = node.find(path, namespaces) |
| 162 | except SyntaxError: |
| 163 | found = None |
| 164 | if found is not None and found.text: |
| 165 | return found.text.strip() |
| 166 | return "" |
| 167 | |
| 168 | |
| 169 | def fetch_custom_rss_papers(urls: List[str], limit_per_source: int) -> List[Dict]: |