Discovery

NAME

Syndicate::Discovery - Feed URL discovery and fetching

SYNOPSIS

use Syndicate::Discovery;

my $disc = Syndicate::Discovery.new;
my $feed = $disc.fetch("https://example.com/feed.xml");
my $feed = $disc.discover("https://example.com");
my @urls = $disc.find-feeds($html, $base-url);

DESCRIPTION

Fetches feeds from URLs and discovers feed URLs from HTML pages. Parses <link> tags with rel="alternate" for RSS, Atom, and JSON Feed content types.

METHODS

fetch(Str $url)

Fetches a URL and parses the feed. Dies on HTTP errors.

Security note: SSL/TLS certificates are not verified by the default HTTP::Tiny user agent. Neither HTTP::Tiny nor the underlying IO::Socket::SSL module support certificate verification. For connections requiring TLS verification, pass a custom :$ua. The custom user agent must duck-type HTTP::Tiny: respond to .get(Str $url) with a Hash whose success, status, reason, content, and headers keys behave like HTTP::Tiny's response (content-type, content-length, location headers). Note that Cro::HTTP::Client and HTTP::UserAgent do not satisfy this contract as-is.

Responses are limited to MAX-FEED-SIZE bytes (10 MiB). The Content-Length header is checked before the body is accepted, and the buffered body is re-checked afterwards; a server that streams a body without a Content-Length header is therefore still fully buffered before the limit is enforced.

discover(Str $url)

Fetches a URL, tries to parse as a feed. If that fails, searches the HTML for <link> feed tags and fetches the first discovered feed URL.

Security note: DNS rebinding within the validation/request window is theoretically possible but impractical for single-request feed fetching. The validation runs immediately before each HTTP request, making the TOCTOU window very small.

find-feeds(Str $html, Str $base-url -- Array)>

Returns an array of feed URLs found in HTML by scanning <link> tags with rel="alternate" and appropriate type attributes.

Syndicate v0.0.6

Syndication feed parser and generator

Authors

  • Sasha Abbott

License

CC0-1.0

Dependencies

XMLJSON::Fast:auth<zef:timo>DateTime::GrammarDateTime::FormatHTTP::Tiny:auth<zef:jjatria>IO::Socket::SSLURI

Test Dependencies

Provides

  • Syndicate
  • Syndicate::Atom
  • Syndicate::Atom::Item
  • Syndicate::Builder::Entry
  • Syndicate::Builder::Feed
  • Syndicate::Discovery
  • Syndicate::Extension::DublinCore
  • Syndicate::Extension::ITunes
  • Syndicate::Extension::MediaRSS
  • Syndicate::Extensions
  • Syndicate::Feed
  • Syndicate::FeedResult
  • Syndicate::Format
  • Syndicate::Item
  • Syndicate::JSONFeed
  • Syndicate::JSONFeed::Item
  • Syndicate::Parse
  • Syndicate::RSS
  • Syndicate::RSS::Common
  • Syndicate::RSS::Item
  • Syndicate::RSS::Item::Common
  • Syndicate::RSS::V0_91
  • Syndicate::RSS::V0_91::Item
  • Syndicate::RSS::V1_0
  • Syndicate::RSS::V1_0::Item
  • Syndicate::Stats
  • Syndicate::Utils

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite โ€” the markup and publishing tools behind this site.