mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
fix(cvedetails,tldrtech) (#3735)
This commit is contained in:
parent
143f90da60
commit
b6a9baff94
4 changed files with 75 additions and 79 deletions
|
@ -35,7 +35,10 @@ class TldrTechBridge extends BridgeAbstract
|
|||
|
||||
public function collectData()
|
||||
{
|
||||
$html = getSimpleHTMLDOM(self::URI . $this->getInput('topic') . '/archives');
|
||||
$topic = $this->getInput('topic');
|
||||
$limit = $this->getInput('limit');
|
||||
$url = self::URI . $topic . '/archives';
|
||||
$html = getSimpleHTMLDOM($url);
|
||||
$entries_root = $html->find('div.content-center.mt-5', 0);
|
||||
$added = 0;
|
||||
foreach ($entries_root->children() as $child) {
|
||||
|
@ -46,22 +49,25 @@ class TldrTechBridge extends BridgeAbstract
|
|||
$date_items = explode('/', $child->href);
|
||||
$date = strtotime(end($date_items));
|
||||
$this->items[] = [
|
||||
'uri' => self::URI . $child->href,
|
||||
'title' => $child->plaintext,
|
||||
'uri' => self::URI . $child->href,
|
||||
'title' => $child->plaintext,
|
||||
'timestamp' => $date,
|
||||
'content' => $this->parseEntry(self::URI . $child->href)
|
||||
'content' => $this->extractContent(self::URI . $child->href),
|
||||
];
|
||||
$added++;
|
||||
if ($added >= $this->getInput('limit')) {
|
||||
if ($added >= $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function parseEntry($uri)
|
||||
private function extractContent($url)
|
||||
{
|
||||
$html = getSimpleHTMLDOM($uri);
|
||||
$html = getSimpleHTMLDOM($url);
|
||||
$content = $html->find('div.content-center.mt-5', 0);
|
||||
if (!$content) {
|
||||
return '';
|
||||
}
|
||||
$subscribe_form = $content->find('div.mt-5 > div > form', 0);
|
||||
if ($subscribe_form) {
|
||||
$content->removeChild($subscribe_form->parent->parent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue