1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-10-17 01:26:08 +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 <?php
declare(strict_types=1);
class YouTubeFeedExpanderBridge extends FeedExpander class YouTubeFeedExpanderBridge extends FeedExpander
{ {
const NAME = 'YouTube Feed Expander'; const NAME = 'YouTube Feed Expander';
@@ -16,22 +18,24 @@ class YouTubeFeedExpanderBridge extends FeedExpander
'embed' => [ 'embed' => [
'name' => 'Add embed to entry', 'name' => 'Add embed to entry',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false,
'title' => 'Add embed to entry', 'title' => 'Add embed to entry',
'defaultValue' => 'checked', 'defaultValue' => 'checked',
], ],
'embedurl' => [ 'embedurl' => [
'name' => 'Use embed page as entry url', 'name' => 'Use embed page as entry url',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false,
'title' => 'Use embed page as entry url', 'title' => 'Use embed page as entry url',
], ],
'nocookie' => [ 'nocookie' => [
'name' => 'Use nocookie embed page', 'name' => 'Use nocookie embed page',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false,
'title' => 'Use nocookie embed page' 'title' => 'Use nocookie embed page'
], ],
'hideshorts' => [
'name' => 'Hide shorts',
'type' => 'checkbox',
'title' => 'Hide shorts'
]
]]; ]];
public function getIcon() public function getIcon()
@@ -51,6 +55,10 @@ class YouTubeFeedExpanderBridge extends FeedExpander
protected function parseItem(array $item) protected function parseItem(array $item)
{ {
if ($this->getInput('hideshorts') && str_contains($item['uri'], '/shorts/')) {
return;
}
$id = $item['yt']['videoId']; $id = $item['yt']['videoId'];
$item['comments'] = $item['uri'] . '#comments'; $item['comments'] = $item['uri'] . '#comments';
$item['uid'] = $item['id']; $item['uid'] = $item['id'];
@@ -79,3 +87,4 @@ class YouTubeFeedExpanderBridge extends FeedExpander
return $item; return $item;
} }
} }