2019-10-03 23:23:14 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class FreeCodeCampBridge extends FeedExpander
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2019-10-03 23:23:14 +03:00
|
|
|
const MAINTAINER = 'IceWreck';
|
|
|
|
const NAME = 'FreeCodecamp Bridge';
|
|
|
|
const URI = 'https://www.freecodecamp.org';
|
|
|
|
const CACHE_TIMEOUT = 3600;
|
|
|
|
const DESCRIPTION = 'RSS feed for FreeCodeCamp';
|
|
|
|
// Freecodecamp removed their old full content rss feed and replaced it with one liner content.
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
$this->collectExpandableDatas('https://www.freecodecamp.org/news/rss/', 15);
|
|
|
|
}
|
|
|
|
|
2023-10-13 02:59:05 +03:00
|
|
|
protected function parseItem(array $item)
|
2019-10-03 23:23:14 +03:00
|
|
|
{
|
2023-10-13 01:25:34 +03:00
|
|
|
$dom = getSimpleHTMLDOM($item['uri']);
|
|
|
|
|
2019-10-03 23:23:14 +03:00
|
|
|
// figure contain's the main article image
|
2023-10-13 01:25:34 +03:00
|
|
|
$article = $dom->find('figure', 0);
|
|
|
|
|
2019-10-03 23:23:14 +03:00
|
|
|
// the actual article
|
2023-10-13 01:25:34 +03:00
|
|
|
foreach ($dom->find('.post-full-content') as $element) {
|
2019-10-03 23:23:14 +03:00
|
|
|
$article = $article . $element;
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
2019-10-03 23:23:14 +03:00
|
|
|
$item['content'] = $article;
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
}
|