mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-31 13:55:07 +03:00
fix: various fixes (#3745)
This commit is contained in:
parent
382648fc22
commit
44fb2c98bc
3 changed files with 16 additions and 11 deletions
|
@ -57,7 +57,7 @@ class CVEDetailsBridge extends BridgeAbstract
|
||||||
$content = $tr->find('.cvesummarylong', 0)->innertext;
|
$content = $tr->find('.cvesummarylong', 0)->innertext;
|
||||||
$cweList = $detailHtml->find('h2', 2)->next_sibling();
|
$cweList = $detailHtml->find('h2', 2)->next_sibling();
|
||||||
foreach ($cweList->find('li') as $li) {
|
foreach ($cweList->find('li') as $li) {
|
||||||
$cweWithDescription = $li->find('a', 0)->innertext;
|
$cweWithDescription = $li->find('a', 0)->innertext ?? '';
|
||||||
|
|
||||||
if (preg_match('/CWE-(\d+)/', $cweWithDescription, $cwe)) {
|
if (preg_match('/CWE-(\d+)/', $cweWithDescription, $cwe)) {
|
||||||
$categories[] = 'CWE-' . $cwe[1];
|
$categories[] = 'CWE-' . $cwe[1];
|
||||||
|
|
|
@ -47,8 +47,8 @@ class CubariBridge extends BridgeAbstract
|
||||||
*/
|
*/
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$jsonSite = getContents($this->getInput('gist'));
|
$json = getContents($this->getInput('gist'));
|
||||||
$jsonFile = json_decode($jsonSite, true);
|
$jsonFile = json_decode($json, true);
|
||||||
|
|
||||||
$this->mangaTitle = $jsonFile['title'];
|
$this->mangaTitle = $jsonFile['title'];
|
||||||
|
|
||||||
|
@ -66,12 +66,14 @@ class CubariBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
$url = $this->getInput('gist');
|
$url = $this->getInput('gist');
|
||||||
|
|
||||||
preg_match('/\/([a-z]*)\.githubusercontent.com(.*)/', $url, $matches);
|
if (preg_match('/\/([a-z]*)\.githubusercontent.com(.*)/', $url, $matches)) {
|
||||||
|
// raw or gist is first match.
|
||||||
// raw or gist is first match.
|
$unencoded = $matches[1] . $matches[2];
|
||||||
$unencoded = $matches[1] . $matches[2];
|
return base64_encode($unencoded);
|
||||||
|
} else {
|
||||||
return base64_encode($unencoded);
|
// todo: fix this
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSanitizedHash($string)
|
private function getSanitizedHash($string)
|
||||||
|
|
|
@ -64,7 +64,7 @@ final class FeedParser
|
||||||
$feed['items'][] = $this->parseAtomItem($item);
|
$feed['items'][] = $this->parseAtomItem($item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception(sprintf('Unable to detect feed format from `%s`', $url));
|
throw new \Exception('Unable to detect feed format');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $feed;
|
return $feed;
|
||||||
|
@ -163,7 +163,9 @@ final class FeedParser
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($feedItem->enclosure) && !empty($feedItem->enclosure['url'])) {
|
if (isset($feedItem->enclosure) && !empty($feedItem->enclosure['url'])) {
|
||||||
$item['enclosures'] = [(string)$feedItem->enclosure['url']];
|
$item['enclosures'] = [
|
||||||
|
(string)$feedItem->enclosure['url'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +191,7 @@ final class FeedParser
|
||||||
{
|
{
|
||||||
$item = [];
|
$item = [];
|
||||||
if (isset($feedItem->link)) {
|
if (isset($feedItem->link)) {
|
||||||
|
// todo: trim uri
|
||||||
$item['uri'] = (string)$feedItem->link;
|
$item['uri'] = (string)$feedItem->link;
|
||||||
}
|
}
|
||||||
if (isset($feedItem->title)) {
|
if (isset($feedItem->title)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue