mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-24 13:03:41 +00:00
Merge pull request '[invidious] Now replaces YouTube links without a leading "www."' (#1494) from loma-one/friendica-addons:develop into develop
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1494 Reviewed-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
commit
38466415b3
1 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* 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.3
|
* Version: 0.4
|
||||||
* 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: Unsupported
|
||||||
|
@ -93,9 +93,9 @@ 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']);
|
||||||
$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']) {
|
||||||
|
|
Loading…
Reference in a new issue