2021-02-28 16:17:54 +03:00
|
|
|
<?php
|
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
class SymfonyCastsBridge extends BridgeAbstract
|
|
|
|
{
|
|
|
|
const NAME = 'SymfonyCasts Bridge';
|
|
|
|
const URI = 'https://symfonycasts.com/';
|
|
|
|
const DESCRIPTION = 'Follow new updates on symfonycasts.com';
|
|
|
|
const MAINTAINER = 'Park0';
|
|
|
|
const CACHE_TIMEOUT = 3600;
|
2021-02-28 16:17:54 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
public function collectData()
|
|
|
|
{
|
2023-09-24 19:15:14 +03:00
|
|
|
$url = 'https://symfonycasts.com/updates/find';
|
|
|
|
$html = getSimpleHTMLDOM($url);
|
|
|
|
|
|
|
|
/** @var simple_html_dom_node[] $dives */
|
|
|
|
$dives = $html->find('div.user-notification-not-viewed');
|
2021-02-28 16:17:54 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
foreach ($dives as $div) {
|
|
|
|
$type = $div->find('h5', 0);
|
2023-09-24 19:15:14 +03:00
|
|
|
$title = $div->find('a', 0);
|
2022-07-01 16:10:30 +03:00
|
|
|
$dateString = $div->find('h5.font-gray', 0);
|
|
|
|
$href = $div->find('a', 0);
|
2023-09-24 19:15:14 +03:00
|
|
|
$hrefAttribute = $href->getAttribute('href');
|
|
|
|
$url = 'https://symfonycasts.com' . $hrefAttribute;
|
2021-02-28 16:17:54 +03:00
|
|
|
|
2023-09-24 19:15:14 +03:00
|
|
|
$item = [];
|
|
|
|
$item['uid'] = $div->getAttribute('data-mark-update-update-url-value');
|
2022-07-01 16:10:30 +03:00
|
|
|
$item['title'] = $title->innertext;
|
2023-09-24 19:15:14 +03:00
|
|
|
|
|
|
|
// this natural language date string does not work
|
2022-07-01 16:10:30 +03:00
|
|
|
$item['timestamp'] = $dateString->innertext;
|
2023-09-24 19:15:14 +03:00
|
|
|
|
2022-07-01 16:10:30 +03:00
|
|
|
$item['content'] = $type->plaintext . '<a href="' . $url . '">' . $title . '</a>';
|
|
|
|
$item['uri'] = $url;
|
|
|
|
$this->items[] = $item; // Add item to the list
|
|
|
|
}
|
|
|
|
}
|
2021-02-28 16:17:54 +03:00
|
|
|
}
|