]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_natgeo/init.php
2 class Af_NatGeo
extends Plugin
{
8 "Fetch content of National Geographic feeds",
12 function init($host) {
15 $host->add_hook($host::HOOK_ARTICLE_FILTER
, $this);
18 function hook_article_filter($article) {
19 $owner_uid = $article["owner_uid"];
21 if (strpos($article["link"], "nationalgeographic.com") !== FALSE) {
23 $doc = new DOMDocument();
24 @$doc->loadHTML(fetch_file_contents($article["link"]));
29 $xpath = new DOMXPath($doc);
31 $basenode = $doc->getElementById("content_mainA");
33 $trash = $xpath->query("//*[@class='aside' or @id='livefyre' or @id='powered_by_livefyre' or @class='social_buttons']");
35 foreach ($trash as $t) {
36 $t->parentNode
->removeChild($t);
40 $article["content"] = $doc->saveXML($basenode);
48 function api_version() {