mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-22 16:13:35 +02:00
fix: various small fixes (#3519)
This commit is contained in:
@@ -23,7 +23,10 @@ class CuriousCatBridge extends BridgeAbstract
|
||||
|
||||
$apiJson = getContents($url);
|
||||
|
||||
$apiData = json_decode($apiJson, true);
|
||||
$apiData = Json::decode($apiJson);
|
||||
if (isset($apiData['error'])) {
|
||||
throw new \Exception($apiData['error_code']);
|
||||
}
|
||||
|
||||
foreach ($apiData['posts'] as $post) {
|
||||
$item = [];
|
||||
|
@@ -47,7 +47,7 @@ class EtsyBridge extends BridgeAbstract
|
||||
|
||||
$item['title'] = $result->find('a', 0)->title;
|
||||
$item['uri'] = $result->find('a', 0)->href;
|
||||
$item['author'] = $result->find('p.wt-text-gray > span', 2)->plaintext;
|
||||
$item['author'] = $result->find('p.wt-text-gray > span', 2)->plaintext ?? '';
|
||||
|
||||
$item['content'] = '<p>'
|
||||
. ($result->find('span.currency-symbol', 0)->plaintext ?? '')
|
||||
|
@@ -66,8 +66,7 @@ class SoundCloudBridge extends BridgeAbstract
|
||||
$item['author'] = $apiItem->user->username;
|
||||
$item['title'] = $apiItem->user->username . ' - ' . $apiItem->title;
|
||||
$item['timestamp'] = strtotime($apiItem->created_at);
|
||||
|
||||
$description = nl2br($apiItem->description);
|
||||
$description = nl2br($apiItem->description ?? '');
|
||||
|
||||
$item['content'] = <<<HTML
|
||||
<p>{$description}</p>
|
||||
|
@@ -233,7 +233,11 @@ class YoutubeBridge extends BridgeAbstract
|
||||
private function getJSONData($html)
|
||||
{
|
||||
$scriptRegex = '/var ytInitialData = (.*?);<\/script>/';
|
||||
preg_match($scriptRegex, $html, $matches) or returnServerError('Could not find ytInitialData');
|
||||
$result = preg_match($scriptRegex, $html, $matches);
|
||||
if (! $result) {
|
||||
Logger::debug('Could not find ytInitialData');
|
||||
return null;
|
||||
}
|
||||
return json_decode($matches[1]);
|
||||
}
|
||||
|
||||
@@ -292,15 +296,17 @@ class YoutubeBridge extends BridgeAbstract
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/([\d]{1,2})\:([\d]{1,2})\:([\d]{2})/', $durationText)) {
|
||||
$durationText = preg_replace('/([\d]{1,2})\:([\d]{1,2})\:([\d]{2})/', '$1:$2:$3', $durationText);
|
||||
} else {
|
||||
$durationText = preg_replace('/([\d]{1,2})\:([\d]{2})/', '00:$1:$2', $durationText);
|
||||
}
|
||||
sscanf($durationText, '%d:%d:%d', $hours, $minutes, $seconds);
|
||||
$duration = $hours * 3600 + $minutes * 60 + $seconds;
|
||||
if ($duration < $duration_min || $duration > $duration_max) {
|
||||
continue;
|
||||
if (is_string($durationText)) {
|
||||
if (preg_match('/([\d]{1,2})\:([\d]{1,2})\:([\d]{2})/', $durationText)) {
|
||||
$durationText = preg_replace('/([\d]{1,2})\:([\d]{1,2})\:([\d]{2})/', '$1:$2:$3', $durationText);
|
||||
} else {
|
||||
$durationText = preg_replace('/([\d]{1,2})\:([\d]{2})/', '00:$1:$2', $durationText);
|
||||
}
|
||||
sscanf($durationText, '%d:%d:%d', $hours, $minutes, $seconds);
|
||||
$duration = $hours * 3600 + $minutes * 60 + $seconds;
|
||||
if ($duration < $duration_min || $duration > $duration_max) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// $vid_list .= $vid . ',';
|
||||
|
Reference in New Issue
Block a user