Relative <audio> embeds broken, not cached/parsed like <video> embeds

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
User avatar
digitalcircuit
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 25 Jan 2017, 03:05

Relative <audio> embeds broken, not cached/parsed like <video> embeds

Postby digitalcircuit » 06 Mar 2017, 08:58

TinyTiny RSS parses and caches HTML 5 video, including rewriting relative links. Unfortunately, it entirely ignores HTML 5 audio, neither parsing (fixing relative links) nor caching. This breaks relative audio embeds.

Example feed: https://zorro.casa/temporary/feed.atom
Try in Firefox's feed viewer and TinyTiny RSS itself. Note that the article links themselves don't exist; that's not relevant.

TinyTiny RSS HTML output (as shown in Firefox dev tools)
Video (working)

Code: Select all

<p>
  Some content goes here.  Here's the video:
    <video controls="controls"><source type="video/ogg" src="https://zorro.casa/temporary/water-and-wind.ogv"><a type="video/ogg" href="https://zorro.casa/temporary/water-and-wind.ogv" rel="noopener noreferrer" target="_blank">A royalty-free video.  Please don't sue me.</a>
    </video></p>

Notice the <source type="video/ogg" src="https://zorro.casa/temporary/...">, an absolute link.

Audio (broken)

Code: Select all

<p>
  Some content goes here.  Here's the audio:
    <audio controls="controls"><source type="audio/mpeg" src="random-spontaneous_devotion.mp3"><a type="audio/mpeg" href="https://zorro.casa/temporary/random-spontaneous_devotion.mp3" rel="noopener noreferrer" target="_blank">A royalty-free song.  Please don't sue me.</a>
    </audio></p>

Notice the <source type="audio/mpeg" src="...">, still relative.

Actual feed content
Video

Code: Select all

<p>
  Some content goes here.  Here's the video:
    <video controls="controls">
      <source type="video/ogg" src="water-and-wind.ogv" />
      <a type="video/ogg" href="water-and-wind.ogv" rel="noopener noreferrer" target="_blank">A royalty-free video.  Please don't sue me.</a>
    </video>
</p>

Audio

Code: Select all

<p>
  Some content goes here.  Here's the audio:                 
    <audio controls="controls">
      <source type="audio/mpeg" src="random-spontaneous_devotion.mp3" />
      <a type="audio/mpeg" href="random-spontaneous_devotion.mp3" rel="noopener noreferrer" target="_blank">A royalty-free song.  Please don't sue me.</a>                                       
    </audio>                                                                                                                                                                                                         
</p>


All regular expressions involving the <video> tag will also need to handle <audio>, such as this...

Code: Select all

$entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src])');


These changes may require handling another extension type other than .mp4 and .png. For reference, see commit 5edd605a.

I planned on making a pull request, only to realize the deeper I dug that I'm not really sure where all in TinyTiny RSS will need changed. I can still try if you prefer.

System details
  • TinyTiny-RSS 270c0a0 (git from tt-rss.org GitLab)
  • nginx 1.10.0-0ubuntu0.16.04.4
  • PostgreSQL 9.5.5-0ubuntu0.16.04
  • PHP 7.0.13-0ubuntu0.16.04.1
  • Ubuntu 16.04 x86_64, Intel

Full feed content (for posterity)/in case server goes down

Code: Select all

<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://zorro.casa/temporary/">
<title type="text">Shane's Test Feed for TinyTiny RSS</title><subtitle type="text">You'll find proof of concepts in here.  No real blogs.</subtitle>
<id>https://zorro.casa/temporary/feed.atom#4</id><link rel="self" type="application/atom+xml" href="https://zorro.casa/temporary/feed.atom" />

<entry>
<author><name>Shane</name><uri>https://zorro.casa/</uri></author>
<title type="text">Example post with HTML5 audio</title><id>https://zorro.casa/temporary/html5-audio#4</id><link rel="alternate" type="text/html" href="https://zorro.casa/temporary/html5-audio" />
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><article>
<p>
  Some content goes here.  Here's the audio:                 
    <audio controls="controls">
      <source type="audio/mpeg" src="random-spontaneous_devotion.mp3" />
      <a type="audio/mpeg" href="random-spontaneous_devotion.mp3" rel="noopener noreferrer" target="_blank">A royalty-free song.  Please don't sue me.</a>                                       
    </audio>                                                                                                                                                                                                         
</p>
</article></div></content>
</entry>

<entry>
<author><name>Shane</name><uri>https://zorro.casa/</uri></author>
<title type="text">Example post with HTML5 video</title><id>https://zorro.casa/temporary/html5-video#4</id><link rel="alternate" type="text/html" href="https://zorro.casa/temporary/html5-video" />
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><article>
<p>
  Some content goes here.  Here's the video:
    <video controls="controls">
      <source type="video/ogg" src="water-and-wind.ogv" />
      <a type="video/ogg" href="water-and-wind.ogv" rel="noopener noreferrer" target="_blank">A royalty-free video.  Please don't sue me.</a>
    </video>
</p>
</article></div></content>
</entry>

</feed>

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Relative <audio> embeds broken, not cached/parsed like <video> embeds

Postby fox » 06 Mar 2017, 09:05

people really need to stop putting relative urls in rss feeds :( but yeah valid point i guess

while we're doing attachments maybe can the ancient flash-based player too, i think all major browsers at this point have mp3 support

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Relative <audio> embeds broken, not cached/parsed like <video> embeds

Postby fox » 06 Mar 2017, 09:23

i've added rewriting for relative audio sources, caching is probably going to come a bit later since there's more stuff to adjust there

also "cache images" options should at this point be renamed to "cache media" or something

thanks for the example feed btw

User avatar
digitalcircuit
Bear Rating Trainee
Bear Rating Trainee
Posts: 8
Joined: 25 Jan 2017, 03:05

Re: Relative <audio> embeds broken, not cached/parsed like <video> embeds

Postby digitalcircuit » 06 Mar 2017, 09:31

The actual atom feed I stumbled across was generated by Tekuti, though I'm not sure if it's fault of the software or the person using it - https://wingolog.org/projects/tekuti/ The particular blog (not made by the author) is accessible from multiple primary domains, hence relative URLs.

Thanks for the quick reply, fix, and I'm glad the example was helpful. Agreed on renaming "cache images", and dropping the flash player.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Relative <audio> embeds broken, not cached/parsed like <video> embeds

Postby fox » 11 Mar 2017, 18:55

re: caching i think the enclosures are in general not handled by cache, which should probably be rectified


Return to “Support”

Who is online

Users browsing this forum: No registered users and 3 guests