From ba67e638005a8044683a42ac21c9699d7b4194f7 Mon Sep 17 00:00:00 2001 From: Jannik Punke Date: Thu, 2 Nov 2023 12:36:51 +0100 Subject: [PATCH] feat: Support wistia short links --- dist/jsVideoUrlParser.js | 4 ++-- dist/jsVideoUrlParser.min.js | 2 +- lib/provider/wistia.js | 4 ++-- lib/provider/wistia.test.js | 21 +++++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/dist/jsVideoUrlParser.js b/dist/jsVideoUrlParser.js index b8d95d2..518cb87 100644 --- a/dist/jsVideoUrlParser.js +++ b/dist/jsVideoUrlParser.js @@ -717,7 +717,7 @@ function Wistia() { this.provider = 'wistia'; - this.alternatives = []; + this.alternatives = ['wi']; this.defaultFormat = 'long'; this.formats = { "long": this.createLongUrl, @@ -736,7 +736,7 @@ }; Wistia.prototype.parseChannel = function (url) { - var match = url.match(/(?:(?:https?:)?\/\/)?([^.]*)\.wistia\./); + var match = url.match(/(?:(?:https?:)?\/\/)?([^.]*)\.(?:wistia\.com|wi\.st)/); var channel = match ? match[1] : undefined; if (channel === 'fast' || channel === 'content') { diff --git a/dist/jsVideoUrlParser.min.js b/dist/jsVideoUrlParser.min.js index 42da5d4..61a1258 100644 --- a/dist/jsVideoUrlParser.min.js +++ b/dist/jsVideoUrlParser.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).urlParser=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=function(t,i){if("object"!==e(t))return"";var r="",a=0,s=Object.keys(t);if(0===s.length)return"";for(s.sort(),i||(r+="?"+s[0]+"="+t[s[0]],a+=1);a { }); }); +test('Wistia: short urls', () => { + testUrls(newParser(), { + videoInfo: { + channel: 'appboss', + id: 'lpu6bgplle', + mediaType: 'video', + provider: 'wistia' + }, + formats: { + long: 'https://appboss.wistia.com/medias/lpu6bgplle', + embed: 'https://fast.wistia.com/embed/iframe/lpu6bgplle', + embedjsonp: 'https://fast.wistia.com/embed/medias/lpu6bgplle.jsonp', + }, + urls: [ + 'https://appboss.wi.st/medias/lpu6bgplle', + ], + }); +}); + test('Wistia: embed urls', () => { testUrls(newParser(), { videoInfo: { @@ -78,6 +97,8 @@ test('Wistia: embed urls', () => { 'https://wistia.com/blog/soapbox-videos-for-the-holidays?wvideo=lpu6bgplle', 'https://wistia.com/library/how-to-look-good-on-a-webcam?wvideo=lpu6bgplle', 'https://wistia.com/solutions/sales?wvideo=lpu6bgplle', + 'https://fast.wi.st/embed/iframe/lpu6bgplle', + 'https://fast.wi.st/embed/medias/lpu6bgplle.jsonp' ], }); testUrls(newParser(), {