]> git.mxchange.org Git - friendica-addons.git/commitdiff
invidious/invidious.php aktualisiert
authorloma-one <loma-one@noreply.git.friendi.ca>
Sun, 14 Apr 2024 17:45:06 +0000 (19:45 +0200)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 15 Apr 2024 05:08:29 +0000 (01:08 -0400)
Now intercepts YouTube links without a leading "www".

invidious/invidious.php

index 1078d26dfb857bd2274700baab93072a9e861980..6ae9bc7869edbd3e9b37b9f9533bc4ff0ff40415 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Name: invidious
  * Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node.
- * Version: 0.3
+ * Version: 0.4
  * Author: Matthias Ebers <https://loma.ml/profile/feb>
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
  * Status: Unsupported
@@ -96,6 +96,9 @@ 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\/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?:\/\/youtube.com\/watch\?v\=(.*?)/ism", $server . '/watch?v=$1', $b['html']);
+       $b['html'] = preg_replace("/https?:\/\/youtube.com\/embed\/(.*?)/ism", $server . '/embed/$1', $b['html']);
+       $b['html'] = preg_replace("/https?:\/\/youtube.com\/shorts\/(.*?)/ism", $server . '/shorts/$1', $b['html']);
        $b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']);
 
        if ($original != $b['html']) {