fossar / selfoss

multipurpose rss reader, live stream, mashup, aggregation web application
https://selfoss.aditu.de
GNU General Public License v3.0
2.38k stars 345 forks source link

Improve Media-RSS rendering #1156

Open azmeuk opened 5 years ago

azmeuk commented 5 years ago

Some video platform like Youtube or Peertube use the Media-RSS extension to provide metadata about the videos. They generally do not use the whole tags available, but provide tags for the video description, the thumbnail, and the number of views.

It would be amazing if selfoss could at least display the thumbnail and the description for videos.

An extract of a Youtube feed:

  <media:group>
   <media:title>Can You Observe a Typical Universe?</media:title>
   <media:content url="https://www.youtube.com/v/q-6oU3jXAho?version=3" type="application/x-shockwave-flash" width="640" height="390"/>
   <media:thumbnail url="https://i2.ytimg.com/vi/q-6oU3jXAho/hqdefault.jpg" width="480" height="360"/>
   <media:description>Sign Up on Patreon to get access to the Space Time Discord! 
https://www.patreon.com/pbsspacetime

Check out the Space Time Merch Store
https://pbsspacetime.com/

The moment you started observing reality, you hopelessly polluted any conclusions you might make about it. The anthropic principle guarantees that you are NOT seeing the universe in most typical state. But used correctly, this highly controversial idea can be extremely powerful. So, how do you correctly use the anthropic principle?

Hosted by Matt O'Dowd
Written by Matt O'Dowd
Graphics by Leonardo Scholzer &amp; Adriano Leal
Directed by: Andrew Kornhaber
Executive Producers: Eric Brown &amp; Andrew Kornhaber 
...</media:description>
   <media:community>
    <media:starRating count="7709" average="4.92" min="1" max="5"/>
    <media:statistics views="176224"/>
   </media:community>http://www.rssboard.org/media-rss
  </media:group>

How it is displayed:

selfoss-youtube

An extract of a Peertube feed:


<media:group>
                <media:content type="application/x-bittorrent" url="https://framatube.org/static/torrents/ed5c048d-01f3-4ceb-97db-6e278de512b0-1080.torrent" isDefault="true">
                </media:content>
                <media:content type="application/x-bittorrent" url="https://framatube.org/static/torrents/ed5c048d-01f3-4ceb-97db-6e278de512b0-720.torrent">
                </media:content>
                <media:content type="application/x-bittorrent" url="https://framatube.org/static/torrents/ed5c048d-01f3-4ceb-97db-6e278de512b0-480.torrent">
                </media:content>
                <media:content type="application/x-bittorrent" url="https://framatube.org/static/torrents/ed5c048d-01f3-4ceb-97db-6e278de512b0-360.torrent">
                </media:content>
                <media:content type="application/x-bittorrent" url="https://framatube.org/static/torrents/ed5c048d-01f3-4ceb-97db-6e278de512b0-240.torrent">
                </media:content>
                <media:rating>nonadult</media:rating>
            </media:group>
            <media:thumbnail url="https://framatube.org/static/thumbnails/ed5c048d-01f3-4ceb-97db-6e278de512b0.jpg" height="122" width="223">
            </media:thumbnail>

How it is displayed:

selfoss-peertube

jtojnar commented 5 years ago

We do actually support Media RSS in a limited fashion:

The YouTube: channel spout uses the media:thumbnail to get a video preview:

https://github.com/SSilence/selfoss/blob/b1ad55823ff75a3b0a4d1c29131f974ffa092f81/src/spouts/youtube/youtube.php#L86

YouTube feed with thumbnails

And so does the RSS Feed Images spout:

https://github.com/SSilence/selfoss/blob/b1ad55823ff75a3b0a4d1c29131f974ffa092f81/src/spouts/rss/images.php#L35

Unfortunately, selfoss currently shows thumbnails even when the item is collapsed, which is pretty ugly.


I agree that adding proper support for Media RSS is a good idea.

I would just put all the media contents below the main body. Will need to check that SimplePie does not show both enclosures and media content (it would duplicate it in pramatube feed).

Maybe we could also drop the images and enclosures spouts in favour of the main one.