{"id":4487,"date":"2014-06-06T10:54:23","date_gmt":"2014-06-06T07:54:23","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=4487"},"modified":"2014-06-06T10:54:23","modified_gmt":"2014-06-06T07:54:23","slug":"how-about-a-hook-for-filtering-articles-in-feedparser","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2014\/06\/06\/how-about-a-hook-for-filtering-articles-in-feedparser\/","title":{"rendered":"How about a hook for filtering $articles in FeedParser?"},"content":{"rendered":"<p>I used to get so many old videos as reruns from Youtube feeds that I got fed up with it and made these changes to init() in classes\/feedparser.php (added lines prefixed with &#8217;+&#8217;):<\/p>\n<p><code>foreach ($articles as $article) {<br \/>\n+\u00a0 \u00a0 $ju_article = new FeedItem_Atom($article, $this-&gt;doc, $this-&gt;xpath);<br \/>\n+\u00a0 \u00a0 if ($ju_article-&gt;get_date() &lt; strtotime(\"-14 days\")) continue;<br \/>\n+<br \/>\narray_push($this-&gt;items, new FeedItem_Atom($article, $this-&gt;doc, $this-&gt;xpath));<br \/>\n}<br \/>\n<\/code><\/p>\n<p>(And the same logic for each feed type.)<\/p>\n<p>This seems to work as I like, forcibly dropping everything older than two weeks (I generally don&#8217;t care for old content). However, as it is a core change, I&#8217;ll have to reimplement it each time TTRSS is updated. Any chance of getting a hook in there somewhere (perhaps operating on $articles prior to that foreach), to do this type of prefiltering in a plugin?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This forcibly drops everything older than two weeks. It&#8217;s a core change, any chance of getting a hook for $articles in there somewhere?<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1097],"tags":[12612],"class_list":["post-4487","post","type-post","status-publish","format-standard","hentry","category-keskustelupalstat","tag-tiny-tiny-rss","sijainti-tiny-tiny-rss-community-forums"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=4487"}],"version-history":[{"count":7,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4487\/revisions"}],"predecessor-version":[{"id":4494,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4487\/revisions\/4494"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=4487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=4487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=4487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}