diff --git a/README.md b/README.md index 582ad7c..3046bc9 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,7 @@ As of version 3.x, EmbedVideo supports embedding video content from the followin | [YouTube](http://www.youtube.com/) | `youtube` - Single Videos | pSsYTj9kCHE | https://www.youtube.com/watch?v=pSsYTj9kCHE | | [YouTube](http://www.youtube.com/) | `youtubeplaylist` - Playlists | PLY0KbDiiFYeNgQkjujixr7qD-FS8qecoP | https://www.youtube.com/embed/?listType=playlist&list=PLY0KbDiiFYeNgQkjujixr7qD-FS8qecoP | | [YouTube](http://www.youtube.com/) | `youtubevideolist` - Video List | pSsYTj9kCHE - urlargs=playlist=pSsYTj9kCHE,pSsYTj9kCHE | https://www.youtube.com/embed/pSsYTj9kCHE?playlist=pSsYTj9kCHE,pSsYTj9kCHE | +| [Youku](http://www.youku.com/) | `youku` | XMzc0Mzg4NTE5Mg |https://player.youku.com/embed/XMzc0Mzg4NTE5Mg | ### New Services New services can be requested by using the following [link](https://github.com/StarCitizenWiki/mediawiki-extensions-EmbedVideo/issues/new?assignees=&labels=enhancement&template=embed-service-request.md&title=Embed+Service+Request%3A+Service+Name) or clicking `New Issue`. diff --git a/extension.json b/extension.json index e5dd295..5c6322f 100644 --- a/extension.json +++ b/extension.json @@ -51,6 +51,7 @@ "embedvideo-service-videolink", "embedvideo-service-vimeo", "embedvideo-service-youtube", + "embedvideo-service-youku", "embedvideo-service-localvideo", "embedvideo-service-externalvideo", "embedvideo-consent-privacy-notice-text", diff --git a/i18n/ar.json b/i18n/ar.json index 246b42b..cab4cb0 100644 --- a/i18n/ar.json +++ b/i18n/ar.json @@ -30,6 +30,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "ملف محلي", "embedvideo-service-externalvideo": "فيديو خارجي", "embedvideo-play": "تشغيل الفيديو", diff --git a/i18n/de.json b/i18n/de.json index c531685..f5be6c0 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -33,6 +33,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Lokale Datei", "embedvideo-service-externalvideo": "Externes Video", "embedvideo-play": "Video abspielen", diff --git a/i18n/en.json b/i18n/en.json index b544d8d..c21e59b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -27,6 +27,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Local File", "embedvideo-service-externalvideo": "External Video", "embedvideo-play": "Play Video", diff --git a/i18n/es.json b/i18n/es.json index a44e9ad..6a4a5d5 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -29,6 +29,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-externalvideo": "Video external", "embedvideo-play": "Reproducir", "embedvideo-error-missingparams": "EmbedVideo; falta un parámetro requerido.", diff --git a/i18n/fr.json b/i18n/fr.json index cae70cb..b5fc8d9 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -31,6 +31,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Fichier local", "embedvideo-service-externalvideo": "Vidéo externe", "embedvideo-play": "Voir la vidéo", diff --git a/i18n/ia.json b/i18n/ia.json index d7957ca..abd6ae8 100644 --- a/i18n/ia.json +++ b/i18n/ia.json @@ -29,6 +29,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "File local", "embedvideo-service-externalvideo": "Video externe", "embedvideo-play": "Reproducer video", diff --git a/i18n/ja.json b/i18n/ja.json index 7975a16..e087c19 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -27,6 +27,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-error-alignment": "EmbedVideo の配置パラメーター \"$1\" に無効な値が指定されました。有効な値は、\"left\"、\"center\"、\"right\" のいずれかです。", "embedvideo-error-valignment": "EmbedVideo の valignment パラメーター \"$1\" に無効な値が指定されました。有効な値は、\"top\"、\"middle\"、\"bottom\"、または \"baseline\" です。", "embedvideo-error-unknown": "動画埋め込みブロックを生成しようとしたときに、EmbedVideo で不明なエラーが発生しました。($1)", diff --git a/i18n/kaa.json b/i18n/kaa.json index 727f4f0..4dacd29 100644 --- a/i18n/kaa.json +++ b/i18n/kaa.json @@ -25,5 +25,6 @@ "embedvideo-service-twitch": "Twitch", "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", - "embedvideo-service-youtube": "YouTube" + "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku" } diff --git a/i18n/lb.json b/i18n/lb.json index e5109c5..5e49680 100644 --- a/i18n/lb.json +++ b/i18n/lb.json @@ -27,6 +27,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Lokale Fichier", "embedvideo-service-externalvideo": "Externe Video", "embedvideo-play": "Video spillen", diff --git a/i18n/lt.json b/i18n/lt.json index 750b33c..533c726 100644 --- a/i18n/lt.json +++ b/i18n/lt.json @@ -27,6 +27,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-externalvideo": "Išorinis vaizdo įrašas", "embedvideo-play": "Leisti vaizdo įrašą", "embedvideo-error-missingparams": "EmbedVideo trūksta būtino parametro.", diff --git a/i18n/mk.json b/i18n/mk.json index 12102da..6a04225 100644 --- a/i18n/mk.json +++ b/i18n/mk.json @@ -29,6 +29,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Месна податотека", "embedvideo-service-externalvideo": "Надворешно видео", "embedvideo-play": "Пушти видео", diff --git a/i18n/pl.json b/i18n/pl.json index 0152f10..0cc5380 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -20,6 +20,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-error-missingparams": "Nie podano wymaganego parametru EmbedVideo.", "embedvideo-error-service": "EmbedVideo nie rozpoznaje usługi wideo „$1”.", "embedvideo-error-id": "EmbedVideo napotkał błędne ID „$2” dla usługi „$1”.", diff --git a/i18n/pt-br.json b/i18n/pt-br.json index 33ace86..f35b234 100644 --- a/i18n/pt-br.json +++ b/i18n/pt-br.json @@ -30,6 +30,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-play": "Reproduzir vídeo", "embedvideo-error-missingparams": "O EmbedVideo está faltando um parâmetro requerido.", "embedvideo-error-width": "O EmbedVideo recebeu o parâmetro de largura ruim \"$1\".", diff --git a/i18n/pt.json b/i18n/pt.json index 2b4fdc8..bb63967 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -28,6 +28,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-play": "Reproduzir vídeo", "embedvideo-error-missingparams": "Falta um parâmetro obrigatório em EmbedVideo.", "embedvideo-error-service": "EmbedVideo não reconhece o serviço de vídeo \"$1\".", diff --git a/i18n/ru.json b/i18n/ru.json index 4ced344..11e4822 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -28,6 +28,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Локальный файл", "embedvideo-error-missingparams": "В теге EmbedVideo отуствует обязательный параметр.", "embedvideo-error-service": "Тег EmbedVideo не может распознать сервис \"$1\".", diff --git a/i18n/sh-latn.json b/i18n/sh-latn.json index fb943cd..fcd96c5 100644 --- a/i18n/sh-latn.json +++ b/i18n/sh-latn.json @@ -24,5 +24,6 @@ "embedvideo-service-twitch": "Twitch", "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", - "embedvideo-service-youtube": "YouTube" + "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku" } diff --git a/i18n/sl.json b/i18n/sl.json index 821c387..d0dd937 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -29,6 +29,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Lokalna datoteka", "embedvideo-service-externalvideo": "Zunanji video", "embedvideo-play": "Predvajaj video", diff --git a/i18n/sv.json b/i18n/sv.json index 2df01c2..2bab239 100644 --- a/i18n/sv.json +++ b/i18n/sv.json @@ -24,6 +24,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-error-missingparams": "EmbedVideo - En obligatorisk parameter har utelämnats.", "embedvideo-error-service": "EmbedVideo - Känner inte till videotjänsten \"$1\".", "embedvideo-error-id": "EmbedVideo - Felaktig id \"$2\" för tjänsten \"$1\" har angivits.", diff --git a/i18n/tr.json b/i18n/tr.json index e725f4e..73cf4ca 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -31,6 +31,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-service-localvideo": "Yerel Dosya", "embedvideo-play": "Videoyu Oynat", "embedvideo-error-missingparams": "EmbedVideo'da kullanılması zorunlu bir parametre eksik.", diff --git a/i18n/uk.json b/i18n/uk.json index ddc2195..be78bcb 100644 --- a/i18n/uk.json +++ b/i18n/uk.json @@ -21,6 +21,7 @@ "embedvideo-service-vimeo": "Vimeo", "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", + "embedvideo-service-youku": "Youku", "embedvideo-error-missingparams": "У EmbedVideo відсутній необхідний параметр.", "embedvideo-error-service": "EmbedVideo не розпізнає відеосервіс \"$1\".", "embedvideo-error-id": "EmbedVideo отримав поганий ідентифікатор \"$2\" за послугу \"$1\".", diff --git a/includes/EmbedService/EmbedServiceFactory.php b/includes/EmbedService/EmbedServiceFactory.php index 56193e5..7b57c75 100644 --- a/includes/EmbedService/EmbedServiceFactory.php +++ b/includes/EmbedService/EmbedServiceFactory.php @@ -53,6 +53,7 @@ final class EmbedServiceFactory { YouTubeOEmbed::class, YouTubePlaylist::class, YouTubeVideoList::class, + Youku::class, ]; /** @@ -155,6 +156,8 @@ public static function newFromName( string $serviceName, string $id ): AbstractE case 'youtubevideolist': return new YouTubeVideoList( $id ); + case 'youku': + return new Youku( $id ); default: throw new InvalidArgumentException( sprintf( 'VideoService "%s" not recognized.', $serviceName ) ); diff --git a/includes/EmbedService/Youku.php b/includes/EmbedService/Youku.php new file mode 100644 index 0000000..9b52dc4 --- /dev/null +++ b/includes/EmbedService/Youku.php @@ -0,0 +1,68 @@ + 'true', + ]; + /** + * @inheritDoc + */ + public function getServiceKey(): string { + return 'youku'; + } + /** + * @inheritDoc + */ + public function getBaseUrl(): string { + return '//player.youku.com/embed/%1$s'; + } + + /** + * @inheritDoc + */ + protected function getUrlRegex(): array { + return [ + '#id_([\d\w-]+).html#is', + ]; + } + + /** + * @inheritDoc + */ + protected function getIdRegex(): array { + return [ + '#^(?:id_)?([\d\w-]+)$#is' + ]; + } + + /** + * @inheritDoc + */ + public function getPrivacyPolicyUrl(): ?string { + return 'https://terms.alicdn.com/legal-agreement/terms/suit_bu1_unification/suit_bu1_unification202005141916_91107.html'; + } + + /** + * @inheritDoc + */ + public function getCSPUrls(): array { + return [ + 'https://youku.com', + 'https://player.youku.com', + ]; + } + + /** + * @inheritDoc + */ + public function getUrl(): string { + return sprintf( $this->getBaseUrl(), $this->getId() ); + } +}