1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-10-16 09:06:16 +02:00

[YouTubeFeedExpanderBridge] Add option to exclude shorts (#4729)

This commit is contained in:
XNAND
2025-09-14 17:11:50 +01:00
committed by GitHub
parent 525e5ddb1d
commit ffe98b1eaf

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
class YouTubeFeedExpanderBridge extends FeedExpander
{
const NAME = 'YouTube Feed Expander';
@@ -16,22 +18,24 @@ class YouTubeFeedExpanderBridge extends FeedExpander
'embed' => [
'name' => 'Add embed to entry',
'type' => 'checkbox',
'required' => false,
'title' => 'Add embed to entry',
'defaultValue' => 'checked',
],
'embedurl' => [
'name' => 'Use embed page as entry url',
'type' => 'checkbox',
'required' => false,
'title' => 'Use embed page as entry url',
],
'nocookie' => [
'name' => 'Use nocookie embed page',
'type' => 'checkbox',
'required' => false,
'title' => 'Use nocookie embed page'
],
'hideshorts' => [
'name' => 'Hide shorts',
'type' => 'checkbox',
'title' => 'Hide shorts'
]
]];
public function getIcon()
@@ -51,6 +55,10 @@ class YouTubeFeedExpanderBridge extends FeedExpander
protected function parseItem(array $item)
{
if ($this->getInput('hideshorts') && str_contains($item['uri'], '/shorts/')) {
return;
}
$id = $item['yt']['videoId'];
$item['comments'] = $item['uri'] . '#comments';
$item['uid'] = $item['id'];
@@ -79,3 +87,4 @@ class YouTubeFeedExpanderBridge extends FeedExpander
return $item;
}
}