[RobinhoodSnacks] Add bridge for Robinhood Snacks (#1460)
This commit is contained in:
parent
7b63da522f
commit
366d2d66b3
1 changed files with 27 additions and 0 deletions
27
bridges/RobinhoodSnacksBridge.php
Normal file
27
bridges/RobinhoodSnacksBridge.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class RobinhoodSnacksBridge extends BridgeAbstract {
|
||||||
|
const MAINTAINER = 'johnpc';
|
||||||
|
const NAME = 'Robinhood Snacks Newsletter';
|
||||||
|
const URI = 'https://snacks.robinhood.com/newsletters/';
|
||||||
|
const CACHE_TIMEOUT = 86400; // 24h
|
||||||
|
const DESCRIPTION = 'Returns newsletters from Robinhood Snacks';
|
||||||
|
|
||||||
|
public function collectData()
|
||||||
|
{
|
||||||
|
$html = getSimpleHTMLDOM(self::URI)
|
||||||
|
or returnServerError('Could not request snacks.robinhood.com.');
|
||||||
|
|
||||||
|
foreach ($html->find('#root > div > div > div > div > div > a') as $element) {
|
||||||
|
if ($element->href === 'https://snacks.robinhood.com/newsletters/page/2/') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->items[] = array(
|
||||||
|
'uri' => $element->href,
|
||||||
|
'title' => $element->find('div > div', 3)->plaintext,
|
||||||
|
'content' => $element->find('div > div', 4)->plaintext,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue