From 4df3b8afbf708d2cd6721621d54b37e4e6ee3f7c Mon Sep 17 00:00:00 2001 From: "H. C. Kruse" Date: Sat, 24 Feb 2024 10:04:30 +0100 Subject: [PATCH] feat: Add Wistia / Spotify Shows / Episodes Implements #79 Implements #81 Implements #82 --- README.md | 43 ++++++++-------- i18n/en.json | 1 + includes/EmbedService/EmbedServiceFactory.php | 16 ++++++ .../EmbedService/Spotify/SpotifyEpisode.php | 23 +++++++++ includes/EmbedService/Spotify/SpotifyShow.php | 23 +++++++++ includes/EmbedService/Wistia.php | 50 +++++++++++++++++++ resources/fetchers/fetchFactory.js | 9 ++++ resources/fetchers/oembed.js | 15 ++++++ 8 files changed, 160 insertions(+), 20 deletions(-) create mode 100644 includes/EmbedService/Spotify/SpotifyEpisode.php create mode 100644 includes/EmbedService/Spotify/SpotifyShow.php create mode 100644 includes/EmbedService/Wistia.php diff --git a/README.md b/README.md index 13d4821..582ad7c 100644 --- a/README.md +++ b/README.md @@ -260,26 +260,29 @@ or As of version 3.x, EmbedVideo supports embedding video content from the following services: -| Site | Service Name(s) | ID Example | URL Example(s) | -|----------------------------------------------------------|---------------------------------|--------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| -| [Archive.org Videos](https://archive.org/details/movies) | `archiveorg` | electricsheep-flock-244-80000-6 | https://archive.org/details/electricsheep-flock-244-80000-6
https://archive.org/embed/electricsheep-flock-244-80000-6 | -| [Bandcamp](https://bandcamp.com/) | `bandcamp` | 1003592798 | https://emptyhousesmusic.bandcamp.com/album/empty-houses (Click on share/embed, and copy the id after `album=`) | -| [Bilibili](https://www.bilibili.com/) | `bilibili` | BV1Hz4y1k7ae | https://player.bilibili.com/player.html?bvid=1Hz4y1k7ae&page=1 | -| [DailyMotion](https://dailymotion.com/) | `dailymotion` | x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms | http://www.dailymotion.com/video/x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms | -| [KakaoTV](https://tv.kakao.com/) | `kakaotv` | 301157950 | https://play-tv.kakao.com/embed/player/cliplink/301157950 | -| [Loom](https://www.loom.com/) | `loom` | e5b8c04bca094dd8a5507925ab887002 | https://www.loom.com/share/e5b8c04bca094dd8a5507925ab887002 | -| [NaverTV](https://tv.naver.com/) | `navertv` | 27831593 | https://tv.naver.com/embed/27831593 | -| [Niconico](http://nicovideo.jp/) | `niconico` | sm40807360 | https://embed.nicovideo.jp/watch/sm40807360 | -| SharePoint | `sharepoint` | Not Applicable | https://[SUB].sharepoint.com/sites/[PATH]/_layouts/15/embed.aspx?UniqueId=[ID]&embed=[...] | -| [SoundCloud](http://soundcloud.com/) | `soundcloud` | | https://soundcloud.com/skrillex/skrillex-rick-ross-purple-lamborghini | -| [Spotify](http://spotify.com/) | `spotifyalbum` - Art embed | 3B61kSKTxlY36cYgzvf3cP | https://open.spotify.com/album/3B61kSKTxlY36cYgzvf3cP | -| [Spotify](http://spotify.com/) | `spotifyartist` - Artist embed | 0YC192cP3KPCRWx8zr8MfZ | https://open.spotify.com/artist/0YC192cP3KPCRWx8zr8MfZ | -| [Spotify](http://spotify.com/) | `spotifytrack` - Song embed | 6ZFbXIJkuI1dVNWvzJzown | https://open.spotify.com/track/6ZFbXIJkuI1dVNWvzJzown | -| [Twitch](http://www.twitch.tv) | `twitch` - Live Streams | `twitchvod` - Archived Videos on Demand | twitchplayspokemon | -| [Vimeo](http://www.vimeo.com) | `vimeo` | 105035718 | http://vimeo.com/105035718 | -| [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 | +| Site | Service Name(s) | ID Example | URL Example(s) | +|----------------------------------------------------------|-------------------------------------|--------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| +| [Archive.org Videos](https://archive.org/details/movies) | `archiveorg` | electricsheep-flock-244-80000-6 | https://archive.org/details/electricsheep-flock-244-80000-6
https://archive.org/embed/electricsheep-flock-244-80000-6 | +| [Bandcamp](https://bandcamp.com/) | `bandcamp` | 1003592798 | https://emptyhousesmusic.bandcamp.com/album/empty-houses (Click on share/embed, and copy the id after `album=`) | +| [Bilibili](https://www.bilibili.com/) | `bilibili` | BV1Hz4y1k7ae | https://player.bilibili.com/player.html?bvid=1Hz4y1k7ae&page=1 | +| [DailyMotion](https://dailymotion.com/) | `dailymotion` | x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms | http://www.dailymotion.com/video/x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms | +| [KakaoTV](https://tv.kakao.com/) | `kakaotv` | 301157950 | https://play-tv.kakao.com/embed/player/cliplink/301157950 | +| [Loom](https://www.loom.com/) | `loom` | e5b8c04bca094dd8a5507925ab887002 | https://www.loom.com/share/e5b8c04bca094dd8a5507925ab887002 | +| [NaverTV](https://tv.naver.com/) | `navertv` | 27831593 | https://tv.naver.com/embed/27831593 | +| [Niconico](http://nicovideo.jp/) | `niconico` | sm40807360 | https://embed.nicovideo.jp/watch/sm40807360 | +| SharePoint | `sharepoint` | Not Applicable | https://[SUB].sharepoint.com/sites/[PATH]/_layouts/15/embed.aspx?UniqueId=[ID]&embed=[...] | +| [SoundCloud](http://soundcloud.com/) | `soundcloud` | | https://soundcloud.com/skrillex/skrillex-rick-ross-purple-lamborghini | +| [Spotify](http://spotify.com/) | `spotifyalbum` - Art embed | 3B61kSKTxlY36cYgzvf3cP | https://open.spotify.com/album/3B61kSKTxlY36cYgzvf3cP | +| [Spotify](http://spotify.com/) | `spotifyartist` - Artist embed | 0YC192cP3KPCRWx8zr8MfZ | https://open.spotify.com/artist/0YC192cP3KPCRWx8zr8MfZ | +| [Spotify](http://spotify.com/) | `spotifytrack` - Song embed | 6ZFbXIJkuI1dVNWvzJzown | https://open.spotify.com/track/6ZFbXIJkuI1dVNWvzJzown | +| [Spotify](http://spotify.com/) | `spotifyshow` - Podcasts / Shows | 7AWhoFQ3SIkEc6Yp1aOiIM | https://open.spotify.com/show/7AWhoFQ3SIkEc6Yp1aOiIM | +| [Spotify](http://spotify.com/) | `spotifyepisode` - Podcast episodes | 11mET6sr9ghOJ6mi4lmZmZ | https://open.spotify.com/episode/11mET6sr9ghOJ6mi4lmZmZ | +| [Twitch](http://www.twitch.tv) | `twitch` - Live Streams | `twitchvod` - Archived Videos on Demand | twitchplayspokemon | +| [Vimeo](http://www.vimeo.com) | `vimeo` | 105035718 | http://vimeo.com/105035718 | +| [Wistia](http://wistia.com) | `wistia` | 62svuailn2 | https://softwareag-2.wistia.com/medias/62svuailn2 | +| [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 | ### 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/i18n/en.json b/i18n/en.json index 8d7f99f..b544d8d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -25,6 +25,7 @@ "embedvideo-service-twitch": "Twitch", "embedvideo-service-videolink": "Video Link", "embedvideo-service-vimeo": "Vimeo", + "embedvideo-service-wistia": "Wistia", "embedvideo-service-youtube": "YouTube", "embedvideo-service-localvideo": "Local File", "embedvideo-service-externalvideo": "External Video", diff --git a/includes/EmbedService/EmbedServiceFactory.php b/includes/EmbedService/EmbedServiceFactory.php index 69b0ceb..56193e5 100644 --- a/includes/EmbedService/EmbedServiceFactory.php +++ b/includes/EmbedService/EmbedServiceFactory.php @@ -7,6 +7,8 @@ use InvalidArgumentException; use MediaWiki\Extension\EmbedVideo\EmbedService\Spotify\SpotifyAlbum; use MediaWiki\Extension\EmbedVideo\EmbedService\Spotify\SpotifyArtist; +use MediaWiki\Extension\EmbedVideo\EmbedService\Spotify\SpotifyEpisode; +use MediaWiki\Extension\EmbedVideo\EmbedService\Spotify\SpotifyShow; use MediaWiki\Extension\EmbedVideo\EmbedService\Spotify\SpotifyTrack; use MediaWiki\Extension\EmbedVideo\EmbedService\Twitch\Twitch; use MediaWiki\Extension\EmbedVideo\EmbedService\Twitch\TwitchClip; @@ -38,12 +40,15 @@ final class EmbedServiceFactory { SoundCloud::class, SpotifyAlbum::class, SpotifyArtist::class, + SpotifyShow::class, + SpotifyEpisode::class, SpotifyTrack::class, Twitch::class, TwitchClip::class, TwitchVod::class, VideoLink::class, Vimeo::class, + Wistia::class, YouTube::class, YouTubeOEmbed::class, YouTubePlaylist::class, @@ -113,6 +118,14 @@ public static function newFromName( string $serviceName, string $id ): AbstractE case 'spotifytrack': return new SpotifyTrack( $id ); + case 'spotifypodcast': + case 'spotifyshow': + return new SpotifyShow( $id ); + + case 'spotifypodcastepisode': + case 'spotifyepisode': + return new SpotifyEpisode( $id ); + case 'twitch': return new Twitch( $id ); @@ -128,6 +141,9 @@ public static function newFromName( string $serviceName, string $id ): AbstractE case 'vimeo': return new Vimeo( $id ); + case 'wistia': + return new Wistia( $id ); + case 'youtubeoembed': return new YouTubeOEmbed( $id ); diff --git a/includes/EmbedService/Spotify/SpotifyEpisode.php b/includes/EmbedService/Spotify/SpotifyEpisode.php new file mode 100644 index 0000000..1351491 --- /dev/null +++ b/includes/EmbedService/Spotify/SpotifyEpisode.php @@ -0,0 +1,23 @@ +