-
-
Notifications
You must be signed in to change notification settings - Fork 22
Support attached media in <enclosure>
and <media:content>
#978
Replies: 1 comment · 5 replies
-
Hey @hirnsushi - thanks for the details here. The XML will be super useful for me to debug. I'll double check, but I don't think there's much |
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1 -
👀 1
-
I apologize in advance for the infodump 😬 I don't think this should necessarily be specific to Mastodon, apart from ArsTechnica I have so far identified two other regular feeds in my list that exhibit similar issues:
No idea how widespread the use of From my limited understanding (I know nothing about Kotlin, only Bash) for YouTube feeds <item>
<guid isPermaLink="true">https://mastodon.art/@nuclearpasta/114184747482894863</guid>
<link>https://mastodon.art/@nuclearpasta/114184747482894863</link>
<pubDate>Tue, 18 Mar 2025 18:02:55 +0000</pubDate>
<description><p>Chapter 3 was when I started to understand how to draw Joy.<br />Sweaty Joy appreciation post, I guess.</p><p><a href="https://mastodon.art/tags/art" class="mention hashtag" rel="tag">#<span>art</span></a> <a href="https://mastodon.art/tags/webcomic" class="mention hashtag" rel="tag">#<span>webcomic</span></a> <a href="https://mastodon.art/tags/fantasy" class="mention hashtag" rel="tag">#<span>fantasy</span></a> <a href="https://mastodon.art/tags/comics" class="mention hashtag" rel="tag">#<span>comics</span></a> <a href="https://mastodon.art/tags/muscle" class="mention hashtag" rel="tag">#<span>muscle</span></a></p></description>
<media:content url="https://cdn.masto.host/mastodonart/media_attachments/files/114/184/738/565/086/947/original/d585bbb622a6e8d4.jpg" type="image/jpeg" fileSize="72153" medium="image">
<media:rating scheme="urn:simple">nonadult</media:rating>
<media:description type="plain">Joy stands tall</media:description>
</media:content>
<media:content url="https://cdn.masto.host/mastodonart/media_attachments/files/114/184/738/597/541/088/original/9beba877ab5e7b9f.jpg" type="image/jpeg" fileSize="283165" medium="image">
<media:rating scheme="urn:simple">nonadult</media:rating>
<media:description type="plain">Joy runs from a lizard. She's goofy.</media:description>
</media:content>
<media:content url="https://cdn.masto.host/mastodonart/media_attachments/files/114/184/738/563/064/693/original/9ec98ab655e551d5.jpg" type="image/jpeg" fileSize="75142" medium="image">
<media:rating scheme="urn:simple">nonadult</media:rating>
<media:description type="plain">Joy ready to fight. </media:description>
</media:content>
<media:content url="https://cdn.masto.host/mastodonart/media_attachments/files/114/184/738/657/911/155/original/d7b5e0d5ef32a74d.jpg" type="image/jpeg" fileSize="258831" medium="image">
<media:rating scheme="urn:simple">nonadult</media:rating>
<media:description type="plain">detail of promo art for chapter 3. Joy faces the thugs.</media:description>
</media:content>
<category>art</category>
<category>webcomic</category>
<category>fantasy</category>
<category>comics</category>
<category>muscle</category>
</item> The other issue is that Youtube feeds use Having looked a bit closer at this problem I've realized it's far more complex than I initially imagined. So yeah, I'd understand it if this feature request is out-of-scope 🙈 |
Beta Was this translation helpful? Give feedback.
All reactions
-
😕 1 -
👀 1
-
No need to apologize, the more details the better! That's a good point about the combination of Extrapolating, the general issue is that this metadata is usually feed-specific and hard to recombine with the main |
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 1
-
I don't think custom extractors are able to solve the general problem. You could ask the Mastodon WebFinger endpoint if the feed URL contains A few examples: GoToSocial example feed snippet<item>
<title>Hiya, we've just done bugfix release 0.17.1 for #GoToSocial.

https://github.com/superseriousbusiness/gotosocial/releases/tag...</title>
<link>https://gts.superseriousbusiness.org/@gotosocial/statuses/01JAQJ25W45BNPZHX44GC2YVQ6</link>
<description>@[email protected] posted 1 attachment: "Hiya, we've just done bugfix release 0.17.1 for #GoToSocial.

https://github.com/superseriousbusiness/gotosocial/releases/tag/v0.17.1

Fixes a bug in the streaming API that may have been causing...</description>
<content:encoded><![CDATA[<p>Hiya, we've just done bugfix release 0.17.1 for <a href="https://gts.superseriousbusiness.org/tags/gotosocial" class="mention hashtag" rel="tag nofollow noreferrer noopener" target="_blank">#<span>GoToSocial</span></a>.</p><p><a href="https://github.com/superseriousbusiness/gotosocial/releases/tag/v0.17.1" rel="nofollow noreferrer noopener" target="_blank">https://github.com/superseriousbusiness/gotosocial/releases/tag/v0.17.1</a></p><p>Fixes a bug in the streaming API that may have been causing problems for some clients, and adds alt-text for default avatar + header images.</p><p>Updating from 0.17.0 is very simple and quick, but if you're updating from 0.16.0 or below then please read the migration notes carefully and be aware of the big database migrations from 0.17.0.</p><p>Enjoy!</p>]]></content:encoded>
<author>@[email protected]</author>
<enclosure url="https://gts.superseriousbusiness.org/fileserver/016VP4S3BP3QSJBACEQ6J1VFDX/attachment/original/01JAQJ11AV3AE9CSXF0PFNYV01.png" length="12845739" type="image/png"></enclosure>
<guid isPermaLink="true">https://gts.superseriousbusiness.org/@gotosocial/statuses/01JAQJ25W45BNPZHX44GC2YVQ6</guid>
<pubDate>Mon, 21 Oct 2024 14:50:34 +0200</pubDate>
<source>https://gts.superseriousbusiness.org/@gotosocial/feed.rss</source>
</item> PeerTube example feed snippet<item>
<title><![CDATA[Chorus Frog Serenades You]]></title>
<link>https://lone.earth/w/wjp4jxYRMFY219timSDdft</link>
<guid>https://lone.earth/w/wjp4jxYRMFY219timSDdft</guid>
<pubDate>Mon, 10 Mar 2025 23:49:51 GMT</pubDate>
<description><![CDATA[a chorus frog faces the camera and repeatedly inflates their throat to croak. in the background many other frogs can be heard]]></description>
<content:encoded><![CDATA[<p>a chorus frog faces the camera and repeatedly inflates their throat to croak. in the background many other frogs can be heard</p>
]]></content:encoded>
<dc:creator>nature</dc:creator>
<category>Animals</category>
<enclosure length="52358470" type="video/mp4" url="https://lone.earth/download/videos/generate/f583c1d7-121b-451d-97ee-39118f96881f?videoFileIds=560172"/>
<media:community>
<media:statistics views="19"/>
</media:community>
<media:embed url="https://lone.earth/videos/embed/wjp4jxYRMFY219timSDdft"/>
<media:player url="https://lone.earth/w/wjp4jxYRMFY219timSDdft"/>
<media:group>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/1d6bef5b-091f-456f-8943-79839e3a3663-2160.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/998fc455-f4cd-411a-b28f-48ac7e0c404d-720.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/e6594a36-ff09-4145-be0b-8a9d463afb60-480.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/e95c0111-5e14-45e0-ae97-2e5fbd7c3b51-144.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/fb6e0729-312b-45cf-8039-7eefa4394dc4-0.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/0ca5aca1-bac5-4750-87a7-30f643c5c761-2160-hls.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/07a2ef0b-b55f-4213-b8bc-73f89b836e77-720-hls.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/0f5f049b-116d-48af-99f6-117eb7093ec3-480-hls.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/f99d7fb2-d469-42b8-a9e0-4b7ba606ecda-144-hls.torrent" isDefault="false"/>
<media:peerLink type="application/x-bittorrent" href="https://lone.earth/lazy-static/torrents/feeaa11b-27b7-4568-8952-35d95368502d-0-hls.torrent" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="2160" fileSize="52358470" url="https://lone.earth/static/web-videos/0b977812-d647-47e5-849d-d6dfaab17c03-2160.mp4" framerate="30" duration="27" isDefault="true"/>
<media:content type="video/mp4" medium="video" height="720" fileSize="7858804" url="https://lone.earth/static/web-videos/4188d30c-80a1-4625-8e54-c357b8ecc989-720.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="480" fileSize="4383670" url="https://lone.earth/static/web-videos/e4f5e226-fd25-4386-9463-aa53e16d58f0-480.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="144" fileSize="1396815" url="https://lone.earth/static/web-videos/e18ceef5-339b-4479-8e45-bb2bce31f871-144.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="audio/mp4" medium="video" height="0" fileSize="873508" url="https://lone.earth/static/web-videos/33125596-958f-4195-99ad-9512637a1fa0-0.mp4" framerate="0" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="2160" fileSize="52347348" url="https://lone.earth/static/streaming-playlists/hls/f583c1d7-121b-451d-97ee-39118f96881f/b7b65acd-1552-4255-86f3-1a99cb0f728b-2160-fragmented.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="720" fileSize="7848582" url="https://lone.earth/static/streaming-playlists/hls/f583c1d7-121b-451d-97ee-39118f96881f/45e67516-e014-4bb6-b9a5-248f37f4e368-720-fragmented.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="480" fileSize="4373744" url="https://lone.earth/static/streaming-playlists/hls/f583c1d7-121b-451d-97ee-39118f96881f/039ccc6a-1ce2-48e6-8514-26169125c241-480-fragmented.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="video/mp4" medium="video" height="144" fileSize="1385857" url="https://lone.earth/static/streaming-playlists/hls/f583c1d7-121b-451d-97ee-39118f96881f/c16466ea-6374-4dc0-9fd1-646a19736c15-144-fragmented.mp4" framerate="30" duration="27" isDefault="false"/>
<media:content type="audio/mp4" medium="video" height="0" fileSize="874574" url="https://lone.earth/static/streaming-playlists/hls/f583c1d7-121b-451d-97ee-39118f96881f/44617fb3-4ae7-4164-9e3a-affd76855557-0-fragmented.mp4" framerate="0" duration="27" isDefault="false"/>
</media:group>
<media:thumbnail url="https://lone.earth/lazy-static/previews/3feeed83-cfac-4950-b2a7-abe687a94e9f.jpg"/>
<media:thumbnail url="https://lone.earth/lazy-static/thumbnails/119b7306-e36c-4d40-91ab-1fa7aa372d3c.jpg"/>
<media:rating>nonadult</media:rating>
<media:title type="plain">Chorus Frog Serenades You</media:title>
<media:description type="plain">a chorus frog faces the camera and repeatedly inflates their throat to croak. in the background many other frogs can be heard</media:description>
</item> Pixelfed example feed snippet (notable because it actually has duplicate images in
|
Beta Was this translation helpful? Give feedback.
All reactions
-
😕 1 -
👀 1
-
I decided to take a step back and look at how this problem is handled elsewhere because reinventing the wheel is probably not a good idea in this case.. Maybe FreshRSS is a good example since that is supported as a backend.
$this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width]);
The parsing is pretty involved so maybe that should happen upstream in RSS-Parser? That whole problem feels very much out of scope for a simple RSS reader 🙈 An interim step could be to support one of the enclosures that are already parsed (maybe audio for people asking for podcast support, no fancy player, just HTML5 |
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
I'm subsribed to a few feeds (ArsTechnica, any Mastodon profile e.g. Nuclearpasta…) that have preview thumbnails in the article list but don't show these images in article view. The problem seems to be that these images aren't part of
<content:encoded>
or the<description>
, but only show up in<media:content>
.Snippet from the ArsTechnica feed:
Snippet from the Mastodon feed:
This isn't a huge deal for the ArsTechnica feed, it's only a partial feed anyway and loading full content will often show those article images on top. Full content extraction doesn't work for Mastodon feeds however, following for example comic artists or photographers etc. becomes basically impossible.
I would love an option (or a default) to show those preview images in the article view as well, preferably under the headline and before the main content 🙂
Beta Was this translation helpful? Give feedback.
All reactions