Af_redditimgur plugin development and fixes

Hi there,

Long time tt-rss user. I’d like to contribute to tt-rss in general. Specifically, I’m interested in bug fixing and expanding plugins like af_redditimgur. Especially keeping them up-to-date with changes to external sources.

My Gogs account is koffieanon too. I already have a fix lined up for for redditimgur, so it be great if I can fork and PR too.

Cheers!

sure, you should be able to fork things on gogs now.

thank you @koffieanon

i see this warning,

E_WARNING (2)	
plugins/af_redditimgur/init.php:441
	
DOMElement::getAttribute(): Couldn't fetch DOMElement
1. plugins/af_redditimgur/init.php(441): getAttribute(href)
2. classes/rssutils.php(698): hook_article_filter(Array)
3. classes/rssutils.php(148): update_rss_feed(477, 1, )
4. update.php(223): update_daemon_common()

Your welcome.

That refers to this line:
git[dot]tt-rss[dot]org/fox/tt-rss/src/master/plugins/af_redditimgur/init.php#L441

It isn’t related to the latest pull request that I made. Looking at the code it seems that this would occur if the article content contains a link but without an href element. Very curious. If have the feed / article this happened on it is possible to confirm.

If line 401:

$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);

Is modified to require the href attribute in the query, like such:

$content_link = $xpath->query("(//a[@href and contains(., '[link]')])")->item(0);

That will probably fix it. It looks like getAttribute is also called on line 406 (conditionally). I don’t use this plugin so I cannot test against my fix (therefore, I’m not doing a PR).

does this warning also belong to same plugin?

E_USER_WARNING (512)	
include/functions.php:247

Exceeded fetch request quota for ereport.fs.zfs.io: 49

1. include/functions.php(247): user_error(Exceeded fetch request quota for ereport.fs.zfs.io: 49, 512)
2. plugins/af_redditimgur/init.php(335): fetch_file_contents(Array)
3. plugins/af_redditimgur/init.php(434): inline_stuff(Array, [DOMDocument], [DOMXPath])
4. classes/rssutils.php(698): hook_article_filter(Array)
5. classes/rssutils.php(148): update_rss_feed(165, 1, )
6. update.php(223): update_daemon_common()

what happened to searching before posting?