invidious/invidious.php aktualisiert

Now also considers links from "music.youtube"
Raised to version 0.5
Removed the status "not supported. This must have crept in. It was not set by me and that was not my intention.
Users explicitly request the option to set a different server in their personal settings. This function is very important to users. This request should not be ignored.
This commit is contained in:
loma-one 2024-04-16 18:11:23 +02:00
parent d4abc9bac8
commit 528c71879d

View file

@ -2,10 +2,10 @@
/* /*
* Name: invidious * Name: invidious
* Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node. * Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node.
* Version: 0.4 * Version: 0.5
* Author: Matthias Ebers <https://loma.ml/profile/feb> * Author: Matthias Ebers <https://loma.ml/profile/feb>
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported * Status:
* Note: Please use the URL Replace addon instead * Note: Please use the URL Replace addon instead
*/ */
@ -96,6 +96,7 @@ function invidious_render(array &$b)
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/watch\?v=(.*?)~ism", $server . '/watch?v=$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/watch\?v=(.*?)~ism", $server . '/watch?v=$1', $b['html']);
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']);
$b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']);
$b['html'] = preg_replace ("/https?:\/\/music.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']);
$b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); $b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']);
if ($original != $b['html']) { if ($original != $b['html']) {