1
0

Modify article content #20

Open
opened 2013-07-09 08:40:44 +01:00 by oscar-b · 2 comments
oscar-b commented 2013-07-09 08:40:44 +01:00 (Migrated from github.com)

First of all, thanks for an excellent plugin! It is the reason I'm now using tt-rss :)

I do have a suggestion though; a way to modify the article content after it's been fetched. This would allow for all kind of nice things, but the problem I have a the moment is a site that uses scheme-less img hrefs, which aren't handled properly by the feed reader I'm using.

I took a stab at implementing a fix for this particular issue, something like this seems to work very well (to be placed right after the cleanup code):

$nodelist = $basenode->getElementsByTagName("img");
foreach($nodelist as $node) {
    $imgsrc = $node->getAttribute("src");
    if (substr($imgsrc, 0, 2) == '//') {
        $node->setAttribute("src", "http:" . $imgsrc);
    }
}
First of all, thanks for an excellent plugin! It is the reason I'm now using tt-rss :) I do have a suggestion though; a way to modify the article content after it's been fetched. This would allow for all kind of nice things, but the problem I have a the moment is a site that uses scheme-less img hrefs, which aren't handled properly by the feed reader I'm using. I took a stab at implementing a fix for this particular issue, something like this seems to work very well (to be placed right after the cleanup code): ``` $nodelist = $basenode->getElementsByTagName("img"); foreach($nodelist as $node) { $imgsrc = $node->getAttribute("src"); if (substr($imgsrc, 0, 2) == '//') { $node->setAttribute("src", "http:" . $imgsrc); } } ```
oscar-b commented 2013-07-09 08:45:42 +01:00 (Migrated from github.com)

Ah yes sorry, there's some code missing for actually saving the article, but you get the idea.

Ah yes sorry, there's some code missing for actually saving the article, but you get the idea.
mbirth commented 2013-07-30 10:23:15 +01:00 (Migrated from github.com)

Hmm ... the nicest way would be more feed parameters with PHP code which would be executed. But this would also open a giant security hole for shared installations. But I'll think about some way.

Hmm ... the nicest way would be more feed parameters with PHP code which would be executed. But this would also open a giant security hole for shared installations. But I'll think about some way.
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mbirth/ttrss_plugin-af_feedmod#20
No description provided.