mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 14:18:35 +01:00
fix: various small notice fixes (#3474)
* fix(patreon): php notice * fix(pepperbridge): php notice * fix(ebay): php notice * fix(tiktok): php notice * fix(yandex): fix notice * fix(justwatch): notice * lint
This commit is contained in:
parent
372880b5ef
commit
748fc9fd65
@ -84,7 +84,12 @@ class EBayBridge extends BridgeAbstract
|
|||||||
|
|
||||||
$sellerInfo = $listing->find('.s-item__seller-info-text', 0)->plaintext ?? '';
|
$sellerInfo = $listing->find('.s-item__seller-info-text', 0)->plaintext ?? '';
|
||||||
|
|
||||||
$item['enclosures'] = [ $listing->find('.s-item__image-wrapper > img', 0)->src . '#.image' ];
|
$image = $listing->find('.s-item__image-wrapper > img', 0);
|
||||||
|
if ($image) {
|
||||||
|
// Not quite sure why append fragment here
|
||||||
|
$imageUrl = $image->src . '#.image';
|
||||||
|
$item['enclosures'] = [$imageUrl];
|
||||||
|
}
|
||||||
|
|
||||||
$item['content'] = <<<CONTENT
|
$item['content'] = <<<CONTENT
|
||||||
<p>$sellerInfo $location</p>
|
<p>$sellerInfo $location</p>
|
||||||
|
@ -169,10 +169,17 @@ class JustWatchBridge extends BridgeAbstract
|
|||||||
foreach ($titles as $title) {
|
foreach ($titles as $title) {
|
||||||
$item = [];
|
$item = [];
|
||||||
$item['uri'] = $title->find('a', 0)->href;
|
$item['uri'] = $title->find('a', 0)->href;
|
||||||
$item['title'] = $provider->find('picture > img', 0)->alt . ' - ' . $title->find('.title-poster__image > img', 0)->alt;
|
|
||||||
$image = $title->find('.title-poster__image > img', 0)->attr['src'];
|
$itemTitle = sprintf(
|
||||||
if (str_starts_with($image, 'data')) {
|
'%s - %s',
|
||||||
$image = $title->find('.title-poster__image > img', 0)->attr['data-src'];
|
$provider->find('picture > img', 0)->alt ?? '',
|
||||||
|
$title->find('.title-poster__image > img', 0)->alt ?? ''
|
||||||
|
);
|
||||||
|
$item['title'] = $itemTitle;
|
||||||
|
|
||||||
|
$imageUrl = $title->find('.title-poster__image > img', 0)->attr['src'] ?? '';
|
||||||
|
if (str_starts_with($imageUrl, 'data')) {
|
||||||
|
$imageUrl = $title->find('.title-poster__image > img', 0)->attr['data-src'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '<b>Provider:</b> '
|
$content = '<b>Provider:</b> '
|
||||||
@ -190,7 +197,7 @@ class JustWatchBridge extends BridgeAbstract
|
|||||||
$content .= '<b>Poster:</b><br><a href="'
|
$content .= '<b>Poster:</b><br><a href="'
|
||||||
. $title->find('a', 0)->href
|
. $title->find('a', 0)->href
|
||||||
. '"><img src="'
|
. '"><img src="'
|
||||||
. $image
|
. $imageUrl
|
||||||
. '"></a>';
|
. '"></a>';
|
||||||
|
|
||||||
$item['content'] = $content;
|
$item['content'] = $content;
|
||||||
|
@ -100,12 +100,14 @@ class PatreonBridge extends BridgeAbstract
|
|||||||
);
|
);
|
||||||
$item['author'] = $user->full_name;
|
$item['author'] = $user->full_name;
|
||||||
|
|
||||||
if (isset($post->attributes->image)) {
|
$image = $post->attributes->image ?? null;
|
||||||
$item['content'] .= '<p><a href="'
|
if ($image) {
|
||||||
. $post->attributes->url
|
$logo = sprintf(
|
||||||
. '"><img src="'
|
'<p><a href="%s"><img src="%s" /></a></p>',
|
||||||
. $post->attributes->image->thumb_url
|
$post->attributes->url,
|
||||||
. '" /></a></p>';
|
$image->thumb_url ?? $image->url ?? $this->getURI()
|
||||||
|
);
|
||||||
|
$item['content'] .= $logo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post->attributes->content)) {
|
if (isset($post->attributes->content)) {
|
||||||
|
@ -129,7 +129,7 @@ class PepperBridgeAbstract extends BridgeAbstract
|
|||||||
|
|
||||||
// Find the text corresponding to the clock
|
// Find the text corresponding to the clock
|
||||||
$spanDateDiv = $clock->parent()->find('span[class=hide--toW3]', 0);
|
$spanDateDiv = $clock->parent()->find('span[class=hide--toW3]', 0);
|
||||||
$itemDate = $spanDateDiv->plaintext;
|
$itemDate = $spanDateDiv->plaintext ?? '';
|
||||||
// In case of a Local deal, there is no date, but we can use
|
// In case of a Local deal, there is no date, but we can use
|
||||||
// this case for other reason (like date not in the last field)
|
// this case for other reason (like date not in the last field)
|
||||||
if ($this->contains($itemDate, $this->i8n('localdeal'))) {
|
if ($this->contains($itemDate, $this->i8n('localdeal'))) {
|
||||||
@ -481,13 +481,13 @@ HEREDOC;
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
if ($deal->find('span[class*=' . $selector . ']', 0) != null) {
|
if ($deal->find('span[class*=' . $selector . ']', 0) != null) {
|
||||||
return '<div>'
|
$children = $deal->find('span[class*=' . $selector . ']', 0)->children(2);
|
||||||
. $deal->find('span[class*=' . $selector . ']', 0)->children(2)->plaintext
|
if ($children) {
|
||||||
. '</div>';
|
return '<div>' . $children->plaintext . '</div>';
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms a local date into a timestamp
|
* Transforms a local date into a timestamp
|
||||||
|
@ -53,7 +53,13 @@ class TikTokBridge extends BridgeAbstract
|
|||||||
$views = $div->find('strong.video-count', 0)->plaintext;
|
$views = $div->find('strong.video-count', 0)->plaintext;
|
||||||
|
|
||||||
$item['uri'] = $link;
|
$item['uri'] = $link;
|
||||||
$item['title'] = $div->find('a', 1)->plaintext;
|
|
||||||
|
$a = $div->find('a', 1);
|
||||||
|
if ($a) {
|
||||||
|
$item['title'] = $a->plaintext;
|
||||||
|
} else {
|
||||||
|
$item['title'] = $this->getName();
|
||||||
|
}
|
||||||
$item['enclosures'][] = $image;
|
$item['enclosures'][] = $image;
|
||||||
|
|
||||||
$item['content'] = <<<EOD
|
$item['content'] = <<<EOD
|
||||||
|
@ -39,7 +39,12 @@ class YandexZenBridge extends BridgeAbstract
|
|||||||
|
|
||||||
$item['uri'] = $post->share_link;
|
$item['uri'] = $post->share_link;
|
||||||
$item['title'] = $post->title;
|
$item['title'] = $post->title;
|
||||||
$item['timestamp'] = date(DateTimeInterface::ATOM, $post->publication_date);
|
|
||||||
|
$publicationDateUnixTimestamp = $post->publication_date ?? null;
|
||||||
|
if ($publicationDateUnixTimestamp) {
|
||||||
|
$item['timestamp'] = date(DateTimeInterface::ATOM, $publicationDateUnixTimestamp);
|
||||||
|
}
|
||||||
|
|
||||||
$item['content'] = $post->text;
|
$item['content'] = $post->text;
|
||||||
$item['enclosures'] = [
|
$item['enclosures'] = [
|
||||||
$post->image,
|
$post->image,
|
||||||
|
@ -316,7 +316,9 @@ abstract class BridgeAbstract implements BridgeInterface
|
|||||||
}
|
}
|
||||||
$needle = $this->inputs[$this->queriedContext][$input]['value'];
|
$needle = $this->inputs[$this->queriedContext][$input]['value'];
|
||||||
foreach (static::PARAMETERS[$context][$input]['values'] as $first_level_key => $first_level_value) {
|
foreach (static::PARAMETERS[$context][$input]['values'] as $first_level_key => $first_level_value) {
|
||||||
if ($needle === (string)$first_level_value) {
|
// todo: this cast emits error if it's an array
|
||||||
|
$valueString = (string) $first_level_value;
|
||||||
|
if ($needle === $valueString) {
|
||||||
return $first_level_key;
|
return $first_level_key;
|
||||||
} elseif (is_array($first_level_value)) {
|
} elseif (is_array($first_level_value)) {
|
||||||
foreach ($first_level_value as $second_level_key => $second_level_value) {
|
foreach ($first_level_value as $second_level_key => $second_level_value) {
|
||||||
|
@ -43,6 +43,7 @@ final class Logger
|
|||||||
$context['url'] = get_current_url();
|
$context['url'] = get_current_url();
|
||||||
$context['trace'] = trace_to_call_points(trace_from_exception($e));
|
$context['trace'] = trace_to_call_points(trace_from_exception($e));
|
||||||
// Don't log these exceptions
|
// Don't log these exceptions
|
||||||
|
// todo: this logic belongs in log handler
|
||||||
$ignoredExceptions = [
|
$ignoredExceptions = [
|
||||||
'You must specify a format',
|
'You must specify a format',
|
||||||
'Format name invalid',
|
'Format name invalid',
|
||||||
|
@ -420,14 +420,11 @@ function getSimpleHTMLDOMCached(
|
|||||||
$defaultBRText = DEFAULT_BR_TEXT,
|
$defaultBRText = DEFAULT_BR_TEXT,
|
||||||
$defaultSpanText = DEFAULT_SPAN_TEXT
|
$defaultSpanText = DEFAULT_SPAN_TEXT
|
||||||
) {
|
) {
|
||||||
Logger::debug(sprintf('Caching url %s, duration %d', $url, $duration));
|
|
||||||
|
|
||||||
// Initialize cache
|
|
||||||
$cacheFactory = new CacheFactory();
|
$cacheFactory = new CacheFactory();
|
||||||
|
|
||||||
$cache = $cacheFactory->create();
|
$cache = $cacheFactory->create();
|
||||||
$cache->setScope('pages');
|
$cache->setScope('pages');
|
||||||
$cache->purgeCache(86400); // 24 hours (forced)
|
$cache->purgeCache(86400);
|
||||||
|
|
||||||
$params = [$url];
|
$params = [$url];
|
||||||
$cache->setKey($params);
|
$cache->setKey($params);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user