Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed Service Add: Youku #99

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
1 change: 1 addition & 0 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "تشغيل الفيديو",
Expand Down
1 change: 1 addition & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/ia.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
3 changes: 2 additions & 1 deletion i18n/kaa.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
1 change: 1 addition & 0 deletions i18n/lb.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions i18n/mk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Пушти видео",
Expand Down
1 change: 1 addition & 0 deletions i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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”.",
Expand Down
1 change: 1 addition & 0 deletions i18n/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\".",
Expand Down
1 change: 1 addition & 0 deletions i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\".",
Expand Down
1 change: 1 addition & 0 deletions i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\".",
Expand Down
3 changes: 2 additions & 1 deletion i18n/sh-latn.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
1 change: 1 addition & 0 deletions i18n/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions i18n/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\".",
Expand Down
3 changes: 3 additions & 0 deletions includes/EmbedService/EmbedServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ final class EmbedServiceFactory {
YouTubeOEmbed::class,
YouTubePlaylist::class,
YouTubeVideoList::class,
Youku::class,
];

/**
Expand Down Expand Up @@ -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 ) );
Expand Down
68 changes: 68 additions & 0 deletions includes/EmbedService/Youku.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare( strict_types=1 );

namespace MediaWiki\Extension\EmbedVideo\EmbedService;

final class Youku extends AbstractEmbedService {
/**
* @inheritDoc
*/
protected $additionalIframeAttributes = [
'allowfullscreen' => '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() );
}
}
Loading