that’s not what it does. it processes all articles in the feed, again.
I don’t think this is a bug (perhaps a feature request) so hopefully someone can point me in the right direction. It appears when a video (and I expect an image too but haven’t yet confirmed) has a source without a scheme (e.g., http, https), the source is emptied upon processing. I’m trying to work through functions rewrite_relative_url and build_url in include/functions.php to see if the fix belongs there.
For example, I have this feed: RT World News, and it includes this entry: ‘Extremism & violence’: Iran joins Pakistan in blasting Norway for Koran burning stunt under the pretext ‘freedom of expression’ — RT World News. When I use af_readability to inline the article content, I get this iframe:
<iframe allowfullscreen="" frameborder="0" height="100%" width="100%" src=""></iframe>
As the source is blank, it obviously doesn’t show the video. The actual page of the item (https://www.rt.com/news/474397-iran-norway-koran-burning/) shows:
<iframe class="media__youtube-frame lazyloaded" width="100%" height="100%" data-src="//www.youtube.com/embed/PsIJmk3aTZE" frameborder="0" allowfullscreen=""></iframe>
Thus, my assumption is missing a scheme gets src stripped. I’d like to check if an iframe (or image) URL has a scheme and, if not, add one. Do you think the best place for this is a plugin (or modification of af_readability)? Thanks.
rewrite_relative_url() should ignore urls without protocol (https://git.tt-rss.org/fox/tt-rss/src/master/include/functions.php#L1552) so it’s probably something else.
The site is using a data attribute (probably with JavaScript on their site) to replace data-src
with src
. This is most likely for lazy loading purposes. TT-RSS strips the data-src because it’s not standard (data attributes can be used for anything).
There’s nothing wrong here and no bug to fix. You just need to code a plugin to swap the attributes.
Indeed you are correct. Now I see many of my feeds have entries like this (with many images and videos stripped). Thanks for the direction.
If you use HOOK_SANITIZE you can query XPath for the iframe tag and use something like:
if ( empty( $node->getAttribute( 'src' ) ) && $node->hasAttribute( 'data-src' ) )
$node->setAttribute( 'src', $node->getAttribute( 'data-src' ) );
e: This code is untested but should give you the general idea.
Thanks - that’s much cleaner than the version I was working on.