* リンク関係 [CODE(XML)@en[enclosure]] (Atom)

[10] [[リンク関係]] [DFN[[CODE(XML)@en[[[enclosure]]]]]]
([DFN[[CODE(XML URI)[[[http://www.iana.org/assignments/relation/enclosure]]]]]])
は、[CODE(XMLa)@en[[[href]]]] [[属性値]]の [[IRI]] が、[[サイズ]]が大きいかもしれず特別な扱いを要するかもしれない関連[[資源]]を[[識別]]することを表します
[SRC[[[RFC 4287]] 4.2.7.2.]]。

** 関連

[12] [CODE(XMLa)@en[[[length]]]] [[属性]]を同時に指定する[['''べきです''']]
[SRC[[[RFC 4287]] 4.2.7.2.]]。

** 仕様書

- [11] [[RFC 4287]]
-- '''<http://tools.ietf.org/html/rfc4287#section-4.2.7.2>'''

* [CODE(XML)@en[enclosure]] 要素 (RSS)

[1] [[RSS]] の [DFN[[CODE(XMLe)@en[[[enclosure]]]] [[要素]]]]は、
[[項目]]に[[添付]]されている[[媒体物体]]を表します
[SRC@en[[[RSS 2.0]]]]。

:[[要素名]]:[CODE(XMLe)@en[[[enclosure]]]]
:文脈:[CODE(XMLe)@en[[[item]]]] [[要素]]の[[子要素]]として
:[[内容モデル]]:[[空]]
:[[属性]]:
[CODE(XMLa)@en[[[length]]]]、
[CODE(XMLa)@en[[[url]]]]、
[CODE(XMLa)@en[[[type]]]]

仕様書:
-[CITE@en[RSS 2.0 Specification (version 2.0.10)]]
--<http://www.rssboard.org/rss-specification#hrelementsOfLtitemgt>
--<http://www.rssboard.org/rss-specification#ltenclosuregtSubelementOfLtitemgt>
-[CITE@en[RSS Best Practices Profile]] ([TIME[2008-11-21 15:11:45 +09:00]] 版) <http://www.rssboard.org/rss-profile#element-channel-item-enclosure>

** 属性

[2] この[[要素]]には [CODE(XMLa)@en[[[length]]]]、
[CODE(XMLa)@en[[[url]]]]、
[CODE(XMLa)@en[[[type]]]]
の3つの[[属性]]があり、いずれも必須です [SRC@en[[[RSS 2.0]], [[RSS Best Practices Profile]]]]。

** 内容

[5] この[[要素]]の[[内容]]は[[空]]です [SRC@en[[[RSS Best Practices Profile]]]]。

[13] 現実には [[URL]] が[[内容]]にも入っていることがあります。何かとの互換性のためでしょうか。

** 文脈

[6] この[[要素]]は [CODE(XMLe)@en[[[item]]]]  [[要素]]内で高々1つ使うことができます。
それが元々の [[RSS 2.0]] の意図でしたが、明記されていませんでした。
[SRC@en[[[RSS Best Practices Profile]]]]

;; この制約、[[RSS Best Practices Profile]] は [CODE(XMLe)@en[[[item]]]] の節で MUST、
[CODE(XMLe)@en[[[enclosure]]]] の項で SHOULD としており、矛盾しています。

** 実装

[7]  [[Blogware]], [[Movable Type]], [[WordPress]] では1つの [CODE(XMLe)@en[[[item]]]]
に [CODE(XMLe)@en[[[enclosure]]]] を複数含めることができます。
[[BottomFeeder]], [[FeederReader]], [[NewsGator]], [[Safari]]
は複数の [CODE(XMLe)@en[[[enclosure]]]] に対応しています。[SRC@en[[[RSS Best Practices Profile]]]]

[8] [[Bloglines]], [[FeedDemon]], [[Google Reader]], [[Microsoft Internet Explorer 7]]
は複数の [CODE(XMLe)@en[[[enclosure]]]] に対応していません。
複数に対応していないと、最初のものだけで残りは無視されたり、
自動的に[[ダウンロード]]される場合には最初のものだけで残りは手動で[[ダウンロード]]しなければならなかったりします。
[SRC@en[[[RSS Best Practices Profile]]]]

** 例

[3]
[PRE(XML example code)[
<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" />
]PRE]

;; [[RSS 2.0]] 仕様書より

[4] 
[PRE(XML example code)[
<enclosure length="24986239" type="audio/mpeg" url="http://dallas.example.com/joebob_050689.mp3" />
]PRE]

;; [[RSS Best Practices Profile]] より

[9] 
[PRE(XML example code)[
<enclosure url="http://jp.youtube.com/watch?v=iZ97gbsZWYg" type="" length="" />
]PRE]

;; 実利用例より


[14] [CITE@en[RFC 5988 - Web Linking]]
( ([TIME[2012-03-22 09:19:11 +09:00]] 版))
<http://tools.ietf.org/html/rfc5988#page-13>

[FIG(quote)[
[FIGCAPTION[
[15] [CITE@en[RSS tags for Podcasts Connect - Podcasts Connect Help]]
([TIME[2016-03-19 12:10:04 +09:00]] 版)
<https://help.apple.com/itc/podcasts_connect/#/itcb54353390>
]FIGCAPTION]

> The <enclosure> tag has three attributes: URL, length, and type:
> URL. The URL attribute points to your podcast content. The file extension specified within the URL attribute determines whether or note content appears in the podcast directory. Supported file formats include M4A, MP3, MOV, MP4, M4V, PDF, and EPUB.
> Length. The length attribute is the file size in bytes. You can find this information in the properties of your podcast file (on a Mac, choose File > Get Info and refer to the size row).
> Type. The type attribute provides the correct category for the type of file you are using. The type values for the supported file formats are: audio/x-m4a, audio/mpeg, video/quicktime, video/mp4, video/x-m4v, application/pdf, and document/x-epub.
> <enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode2.mp3" length="5650889" type=“audio/mpeg"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[16] ([TIME[2016-03-14 12:53:04 +09:00]] 版)
<http://www.tbsradio.jp/tsutaya/index.xml>
]FIGCAPTION]

> <link>http://podcast.tbsradio.jp/tsutaya/files/20160314.mp3</link>
> <guid>http://podcast.tbsradio.jp/tsutaya/files/20160314.mp3</guid>
> <enclosure url="http://podcast.tbsradio.jp/tsutaya/files/20160314.mp3" type="audio/mpeg"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[17] ([TIME[2016-03-18 18:35:00 +09:00]] 版)
<http://feedpress.me/automagic>
]FIGCAPTION]

>       <link>http://automagic.fm/post/141135511895/magical-remix2</link>
>       <enclosure url="http://yhassy.heteml.jp/mp3/automagic161.5.mp3" length="4326236" type="audio/mpeg"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[18] ([TIME[2016-03-18 16:49:18 +09:00]] 版)
<http://www.joqr.co.jp/blog/golden-opening/index.xml>
]FIGCAPTION]

> 
> <enclosure url="http://podcast.joqr.co.jp/podcast_qr/ootake-opening/ootake-opening160316.mp3" length="15000576" type="audio/mpeg"/>
> ;; [CODE(XMLe)@en[link]] [[要素]]なし。

]FIG]


[FIG(quote)[
[FIGCAPTION[
[19] ([TIME[2016-03-15 11:13:59 +09:00]] 版)
<http://www.nhk.or.jp/lesson/common/rss/podcast/arabic.xml>
]FIGCAPTION]

> <enclosure url="http://www.nhk.or.jp/lesson/arabic/learn/mp3/47-ar-le_01.mp3" length="4801831" type="audio/mpeg"/>
> ;; [CODE(XMLe)@en[link]] [[要素]]なし。
> 

]FIG]


[FIG(quote)[
[FIGCAPTION[
[20] ([TIME[2016-03-19 13:50:33 +09:00]] 版)
<http://wunc.org/podcasts/490/rss.xml>
]FIGCAPTION]

> 
>       <enclosure url="http://cpa.ds.npr.org/wunc/audio/2016/03/sot031816segA.mp3?origin=body" length="0" type="audio/mpeg"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[21] [CITE@en[BitTorrent.org]]
([[Arvid Norberg <arvid@bittorrent.com>]] 著, [TIME[2014-09-29 05:34:53 +09:00]] 版)
<http://www.bittorrent.org/beps/bep_0036.html>
]FIGCAPTION]

> The enclosure tag MUST have a type attribute set to "application/x-bittorrent" and MUST store the torrent link in a url attribute. It MAY have a length attribute, which should indicate the size of the .torrent file, in bytes.
> Example:
> <enclosure type="application/x-bittorrent" length="12216" url="http://featuredcontent.utorrent.com/torrents/WillisEarlBeal-BitTorrent.torrent"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[22] ([TIME[2016-03-19 18:46:40 +09:00]] 版)
<http://news.yahoo.co.jp/pickup/rss.xml>
]FIGCAPTION]

> 
> <enclosure length="133" url="http://i.yimg.jp/images/icon/photo.gif" type="image/gif"></enclosure>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[23] ([TIME[2015-08-25 15:17:11 +09:00]] 版)
<http://omocoro.jp/index/feed/>
]FIGCAPTION]

> 
> <enclosure url="http://omocoro.jp/assets/img/rss/no-image.png"/>

]FIG]


[FIG(quote)[
[FIGCAPTION[
[24] ([TIME[2017-02-02 20:39:05 +09:00]])
<https://blog.mozilla.org/security/category/security-bytes-podcast/feed/>
]FIGCAPTION]

> <enclosure url="https://s3.amazonaws.com/security-bytes-podcast/Mozilla+Security+Bytes+-+Episode+1+-+Content+Security+Policy.mp3" length="39916433" type="audio/mpeg" />

]FIG]


[FIG(quote)[
[FIGCAPTION[
[25] ([TIME[2018-04-28 16:50:55 +09:00]])
<http://www.dra.go.th/rss-cms_19-Thai/>
]FIGCAPTION]

> <enclosure url="http://www.dra.go.th/upload/cms_19/thumbnail_picture/img-1c628154a44069042e4b326df79fd38f.jpg" length="2246" type="image/jpeg" />

]FIG]


[FIG(quote)[
[FIGCAPTION[
[26] ([TIME[2018-04-28 16:51:25 +09:00]])
<http://www.dra.go.th/rss-cms_19-Thai/>
]FIGCAPTION]

> <enclosure url="" length="2246" type="image/jpeg" />

]FIG]

[27] 
[CITE[https://sizu.me/catnose/rss]], [TIME[2023-11-16T03:56:25.000Z]] <https://sizu.me/catnose/rss>

>
[PRE(XML code)[
            <enclosure length="0" type="image/png" url="https://static.sizu.me/api/og-image/f63fc416e7df?avatarUrl=https%3A%2F%2Fr2.sizu.me%2Fusers%2F1%2Favatar.png%3Fv%3D1700028666631&amp;theme=user&amp;username=catnose"/>
]PRE]

[28] 
>>27 [CODE[og:image]] の代用に使われている感あるが、それは [[RSS]] 仕様が想定した使い方なんだろうか。

[29] 
[[フィードリーダー]]でそれっぽい画像が表示されるのを期待して指定しているのかも。
本来の [[RSS]] 仕様の想定とは違う気が。



