1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-10-26 21:11:30 +01:00

Normalize www.youtube.com links to this domain

Links to (non-www) youtube.com work as well, but they get redirected to
the www variant anyways.
This commit is contained in:
Mynacol
2025-10-24 14:46:00 +00:00
parent 9bfc5687e8
commit 03a937b764
3 changed files with 3 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ class GenshinImpactBridge extends BridgeAbstract
if (preg_match($exp_youtube, $article_html, $matches)) {
// Replace the YouTube embed with a YouTube link
$yt_embed = $article_html->find('div[class="ttr-video-frame"]', 0);
$yt_link = sprintf('<a href="https://youtube.com/watch?v=%1$s">https://youtube.com/watch?v=%1$s</a>', $matches[1]);
$yt_link = sprintf('<a href="https://www.youtube.com/watch?v=%1$s">https://www.youtube.com/watch?v=%1$s</a>', $matches[1]);
$article_html = str_replace($yt_embed, $yt_link, $article_html);
}
$item = [];

View File

@@ -126,7 +126,7 @@ class WebfailBridge extends BridgeAbstract
. '"></a>';
} elseif (!is_null($article->find('div.wf-video', 0))) { // Video type
$videoId = $this->getVideoId($article->find('div.wf-play', 0)->onclick);
$item['uri'] = 'https://youtube.com/watch?v=' . $videoId;
$item['uri'] = 'https://www.youtube.com/watch?v=' . $videoId;
$item['content'] = '<a href="'
. $item['uri']
. '"><img src="http://img.youtube.com/vi/'

View File

@@ -112,7 +112,7 @@ class YorushikaBridge extends BridgeAbstract
if (preg_match($exp_youtube, $art_html, $matches)) {
// Replace the YouTube embed with a YouTube link
$yt_embed = $art_html->find('iframe[src*="youtube.com"]', 0);
$yt_link = sprintf('<a href="https://youtube.com/watch?v=%1$s">https://youtube.com/watch?v=%1$s</a>', $matches[1]);
$yt_link = sprintf('<a href="https://www.youtube.com/watch?v=%1$s">https://www.youtube.com/watch?v=%1$s</a>', $matches[1]);
$art_html = str_replace($yt_embed, $yt_link, $art_html);
}