[ 'name' => 'Feed', 'type' => 'list', 'values' => [ 'WIRED Top Stories' => 'rss', // /feed/rss 'Business' => 'business', // /feed/category/business/latest/rss 'Culture' => 'culture', // /feed/category/culture/latest/rss 'Gear' => 'gear', // /feed/category/gear/latest/rss 'Ideas' => 'ideas', // /feed/category/ideas/latest/rss 'Science' => 'science', // /feed/category/science/latest/rss 'Security' => 'security', // /feed/category/security/latest/rss 'Transportation' => 'transportation', // /feed/category/transportation/latest/rss 'Backchannel' => 'backchannel', // /feed/category/backchannel/latest/rss 'WIRED Guides' => 'wired-guide', // /feed/tag/wired-guide/latest/rss 'Photo' => 'photo' // /feed/category/photo/latest/rss ] ], 'limit' => self::LIMIT, ]]; public function collectData() { $feed = $this->getInput('feed'); if (empty($feed) || !ctype_alpha(str_replace('-', '', $feed))) { returnClientError('Invalid feed, please check the "feed" parameter.'); } $feed_url = $this->getURI() . 'feed/'; if ($feed != 'rss') { if ($feed != 'wired-guide') { $feed_url .= 'category/'; } else { $feed_url .= 'tag/'; } $feed_url .= "$feed/latest/"; } $feed_url .= 'rss'; $limit = $this->getInput('limit') ?? -1; $this->collectExpandableDatas($feed_url, $limit); } protected function parseItem(array $item) { $originalContent = $item['content']; $article = getSimpleHTMLDOMCached($item['uri']); $item['content'] = $this->extractArticleContent($article); $headline = $originalContent; if (!empty($headline)) { $item['content'] = '
' . $headline . '
' . $item['content']; } $item_image = $article->find('meta[property="og:image"]', 0); if (!empty($item_image)) { $item['enclosures'] = [$item_image->content]; $item['content'] = '' . $item['content']; } return $item; } private function extractArticleContent($article) { $content = $article->find('article', 0); $truncate = true; if (empty($content)) { $content = $article->find('div.listicle-main-component__container', 0); $truncate = false; } if (!empty($content)) { $content = $content->innertext; } foreach ( [ '