[invidious] Drop support for the addon

- Please use the URL replace addon instead
pull/1483/head
MrPetovan 2024-03-19 12:56:08 -04:00 committed by Hypolite Petovan
parent 67c44792fd
commit da8681c8c4
1 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,8 @@
* Version: 0.3 * Version: 0.3
* 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
* Note: Please use the URL Replace addon instead
*/ */
use Friendica\Core\Hook; use Friendica\Core\Hook;
@ -91,7 +92,7 @@ function invidious_render(array &$b)
$original = $b['html']; $original = $b['html'];
$server = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'invidious', 'server', DI::config()->get('invidious', 'server', INVIDIOUS_DEFAULT)); $server = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'invidious', 'server', DI::config()->get('invidious', 'server', INVIDIOUS_DEFAULT));
$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']);