]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_habr/init.php
2 class Af_Habr
extends Plugin
{
6 "Fetch content of Habrahabr feeds",
10 function init($host) {
13 $host->add_hook($host::HOOK_ARTICLE_FILTER
, $this);
16 function hook_article_filter($article) {
17 $owner_uid = $article["owner_uid"];
19 if (strpos($article["link"], "habrahabr.ru") !== FALSE) {
21 $doc = new DOMDocument();
22 @$doc->loadHTML(fetch_file_contents($article["link"]));
27 $xpath = new DOMXPath($doc);
29 $basenode = $xpath->query("//div[contains(@class,'content') and contains(@class, 'html_format')]")->item(0);
32 $article["content"] = $doc->saveXML($basenode);
40 function api_version() {