Feed-Find-0.07 > Feed::Find

名前

Feed::Find - Syndication feed auto-discovery

Feed::Find - 配信フィードの自動検出

概要

    use Feed::Find;
    my @feeds = Feed::Find->find('http://example.com/');

説明

Feed::Find implements feed auto-discovery for finding syndication feeds, given a URI. It (currently) passes all of the auto-discovery tests at http://diveintomark.org/tests/client/autodiscovery/.

Feed::Find will discover the following feed formats:

  • RSS 0.91

  • RSS 1.0

  • RSS 2.0

  • Atom

Feed::Findは与えられた URIの, 配信フィードの自動検出するための機能を実装しています.

(現在)http://diveintomark.org/tests/client/autodiscovery/にある 自動検出のためのテストをすべてパスしています.

Feed::Findは以下のフィードフォーマットを検出することができます.

  • RSS 0.91

  • RSS 1.0

  • RSS 2.0

  • Atom

USAGE

Feed::Find->find($uri)

Given a URI $uri, use a variety of techniques to find the feeds associated with that page. If $uri itself points to a feed (i.e., if the Content-Type of the response is a recognized feed type), returns $uri.

Returns a list of feed URIs.

The following techniques are used:

1. <link> tag auto-discovery

If the page contains any <link> tags in the <head> section, these tags are examined for recognized feed content types. The following content types are treated as feeds: application/x.atom+xml, application/atom+xml, application/xml, text/xml, application/rss+xml, and application/rdf+xml.

2. Scanning <a> tags

If the page does not contain any known <link> tags, the page is then scanned for <a> tags for links to URIs with certain file extensions. The following extensions are treated as feeds: .rss, .xml, and .rdf.

Note that this technique is employed only if the first technique returns no results.

Feed::Find->find_in_html(\$html [, $base_uri ])

Given a reference to a string $html containing an HTML page, uses the same techniques as described above in find to find the feeds associated with that page.

If you know the URI of the page, you should provide it in $base_uri, so that relative links can be properly made absolute. Feed::Find will attempt to determine the correct base URI, but unless that URI is specified in the HTML itself (in a <meta> tag), you'll need to supply it yourself.

Returns a list of feed URIs.

Feed::Find->find($uri)

与えられた URI $uriに, そのページに関連するフィードを検出するための様々な 手法を用います. もし $uri自身がフィードを示しているのであれば, (すなわち レスポンスのContent-Typeがフィードと認識された場合) $uriが戻り値となります.

フィードの URIのリストが戻り値となります.

以下のテクニックが使用されます.

1. <link>タグ自動検出

ページが<head>セクションに<link>タグを含んでいれば, これらのタグから type属性がフィードと認識できるかについて調べます. 次の type属性をフィードとして扱います: application/x.atom+xml, application/atom+xml, application/xml, text/xml, application/rss+xml, 及びapplication/rdf+xml.

2. <a>タグのスキャン

ページが<link>タグを含んでいなければ, <a>タグのリンクから 特定の拡張子を探します. フィードと扱う拡張子は次のとおりです: .rss, .xml, 及び .rdf.

一つ目の方法で何も戻り値がない場合のみ, この方法が適用されます.

Feed::Find->find_in_html(\$html [, $base_uri ])

HTMLページを含む文字列のリファレンス$htmlを与えます. 上記で述べたfindと 同じ手法を用いてページと関連するフィードを見つけ出します.

ページの URLを知っているのであれば, 相対リンクを適切な絶対リンクにすることが できるので $base_uriを渡すべきでしょう. Feed::Findは正しいベース URIを 決定しようとしますが, HTML自身(<meta>タグ内)で特定することができない のであれば, あなた自身が提供する必要があります.

戻り値はフィードの URIのリストです.

Returns a list of feed URIs.

ライセンス

Feed::Find is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR & COPYRIGHT

Except where otherwise noted, Feed::Find is Copyright 2004 Benjamin Trott, ben+cpan@stupidfool.org. All rights reserved.