mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 14:18:35 +01:00
fix: php errors (#3013)
* fix: php error in tiktok bridge * fix: notice in craigslist * fix: php notice in wordpress bridge * feat: improve ux in telegram bridge
This commit is contained in:
parent
8033a5f461
commit
0dab51e26f
@ -89,9 +89,11 @@ class CraigslistBridge extends BridgeAbstract
|
|||||||
$item['title'] = $heading->plaintext;
|
$item['title'] = $heading->plaintext;
|
||||||
$item['timestamp'] = $post->find('.result-date', 0)->datetime;
|
$item['timestamp'] = $post->find('.result-date', 0)->datetime;
|
||||||
$item['uid'] = $heading->id;
|
$item['uid'] = $heading->id;
|
||||||
$item['content'] = $post->find('.result-price', 0)->plaintext . ' '
|
|
||||||
// Find the location (local and nearby results if searchNearby=1)
|
$price = $post->find('.result-price', 0)->plaintext ?? '';
|
||||||
. $post->find('.result-hood, span.nearby', 0)->plaintext;
|
// Find the location (local and nearby results if searchNearby=1)
|
||||||
|
$nearby = $post->find('.result-hood, span.nearby', 0)->plaintext ?? '';
|
||||||
|
$item['content'] = sprintf('%s %s', $price, $nearby);
|
||||||
|
|
||||||
$images = $post->find('.result-image[data-ids]', 0);
|
$images = $post->find('.result-image[data-ids]', 0);
|
||||||
if (!is_null($images)) {
|
if (!is_null($images)) {
|
||||||
|
@ -4,7 +4,7 @@ class TelegramBridge extends BridgeAbstract
|
|||||||
{
|
{
|
||||||
const NAME = 'Telegram Bridge';
|
const NAME = 'Telegram Bridge';
|
||||||
const URI = 'https://t.me';
|
const URI = 'https://t.me';
|
||||||
const DESCRIPTION = 'Returns newest posts from a public Telegram channel';
|
const DESCRIPTION = 'Returns newest posts from a *public* Telegram channel';
|
||||||
const MAINTAINER = 'VerifiedJoseph';
|
const MAINTAINER = 'VerifiedJoseph';
|
||||||
const PARAMETERS = [[
|
const PARAMETERS = [[
|
||||||
'username' => [
|
'username' => [
|
||||||
@ -49,14 +49,14 @@ class TelegramBridge extends BridgeAbstract
|
|||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM($this->getURI());
|
$html = getSimpleHTMLDOM($this->getURI());
|
||||||
|
|
||||||
$channelTitle = htmlspecialchars_decode(
|
$channelTitle = $html->find('div.tgme_channel_info_header_title span', 0)->plaintext ?? '';
|
||||||
$html->find('div.tgme_channel_info_header_title span', 0)->plaintext,
|
$channelTitle = htmlspecialchars_decode($channelTitle, ENT_QUOTES);
|
||||||
ENT_QUOTES
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->feedName = $channelTitle . ' (@' . $this->processUsername() . ')';
|
$this->feedName = $channelTitle . ' (@' . $this->processUsername() . ')';
|
||||||
|
$posts = $html->find('div.tgme_widget_message_wrap.js-widget_message_wrap');
|
||||||
foreach ($html->find('div.tgme_widget_message_wrap.js-widget_message_wrap') as $index => $messageDiv) {
|
if (!$channelTitle && !$posts) {
|
||||||
|
throw new \Exception('Unable to find channel. The channel is non-existing or non-public.');
|
||||||
|
}
|
||||||
|
foreach ($posts as $messageDiv) {
|
||||||
$this->itemTitle = '';
|
$this->itemTitle = '';
|
||||||
$this->enclosures = [];
|
$this->enclosures = [];
|
||||||
$item = [];
|
$item = [];
|
||||||
|
@ -42,7 +42,8 @@ class TikTokBridge extends BridgeAbstract
|
|||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM($this->getURI());
|
$html = getSimpleHTMLDOM($this->getURI());
|
||||||
|
|
||||||
$this->feedName = htmlspecialchars_decode($html->find('h1', 0)->plaintext);
|
$title = $html->find('h1', 0)->plaintext ?? self::NAME;
|
||||||
|
$this->feedName = htmlspecialchars_decode($title);
|
||||||
|
|
||||||
foreach ($html->find('div.tiktok-x6y88p-DivItemContainerV2') as $div) {
|
foreach ($html->find('div.tiktok-x6y88p-DivItemContainerV2') as $div) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
@ -79,7 +79,7 @@ class WordPressBridge extends FeedExpander
|
|||||||
if (empty($item['enclosures'])) {
|
if (empty($item['enclosures'])) {
|
||||||
$item['enclosures'] = [$article_image];
|
$item['enclosures'] = [$article_image];
|
||||||
} else {
|
} else {
|
||||||
$item['enclosures'] = array_merge($item['enclosures'], $article_image);
|
$item['enclosures'] = array_merge($item['enclosures'], (array) $article_image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user