Before downloading and extracting text at scale, you need a list of URLs to process. Trafilatura can automatically discover those URLs by parsing feeds (Atom, RSS, JSON Feed) and sitemaps (XML, sitemap index, gzip-compressed). Both mechanisms let you filter results by language and restrict discovery to specific sections of a site.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/adbar/trafilatura/llms.txt
Use this file to discover all available pages before exploring further.
Feeds
Parse Atom, RSS, and JSON Feed documents to extract article URLs, or auto-discover feed links from any homepage.
Sitemaps
Parse XML sitemaps and sitemap indexes, or auto-discover them via
robots.txt. Supports nested sitemaps and hreflang filtering.Feeds
Finding Feed URLs with Python
Thefind_feed_urls() function in trafilatura.feeds accepts either a homepage URL or a direct feed URL. When given a homepage it tries to locate feed links in the page’s <link rel="alternate"> elements and linked <a href> anchors; when given a feed URL it parses the feed directly.
Language Filtering
Passtarget_lang (a two-letter ISO 639-1 code) to filter URLs using language heuristics applied to the URL string itself:
Cross-Domain URLs
By default,find_feed_urls() discards links that point to a different domain. Set external=True to include them:
Full Parameter Reference
Feeds on the CLI
Use--feed together with --list to print discovered URLs without downloading them:
Sitemaps
Searching Sitemaps with Python
Thesitemap_search() function in trafilatura.sitemaps works similarly to find_feed_urls(). It accepts a homepage URL or a direct sitemap URL. For a homepage it first reads robots.txt for Sitemap: directives and then tries a set of standard paths (sitemap.xml, sitemap_index.xml, etc.). Nested sitemap indexes are followed recursively.
Language Filtering
Passtarget_lang to filter URLs using language heuristics and hreflang attributes found in the sitemap:
hreflang attributes are present in the sitemap, Trafilatura uses them for precise language matching. Otherwise it falls back to URL-based heuristics.
Cross-Domain URLs
Setexternal=True to include URLs from different domains or subdomains that appear in the sitemap:
Filtering by URL Pattern (Subdirectory)
Pass a subdirectory URL instead of the homepage to limit results to pages under that path. This works becausesitemap_search() applies the subdirectory URL as a filter on the collected links:
Full Parameter Reference
Sitemaps on the CLI
Use--sitemap together with --list to discover and print URLs without downloading them:
URL Filtering
Both the feed and sitemap discovery tools can be narrowed down further using the--url-filter option on the CLI. Only URLs that contain the given string (or any of a comma-separated list of strings) are kept:
Allowing External URLs via Settings
By default, bothfind_feed_urls() and sitemap_search() discard links that point outside the source domain. You can change this default globally by setting EXTERNAL_URLS = on in your settings.cfg file:
Supported Feed Formats
Trafilatura handles the most common syndication formats automatically:Atom
Parses
<link href="..."> elements for article URLs.RSS
Parses
<link> text content for article URLs.JSON Feed
Parses the
items[].url and items[].id fields per the JSON Feed 1.1 spec.Feedburner and Google Feeds proxy URLs are preserved as-is when standard URL validation would otherwise discard them.