Add twitch clip support (#659)

This commit is contained in:
Calvin Montgomery 2017-05-27 11:49:27 -07:00
parent 995ab142e3
commit e9c519c6e2
6 changed files with 36 additions and 1 deletions

View file

@ -1519,7 +1519,8 @@
im: ImgurPlayer,
vm: VideoJSPlayer,
hl: HLSPlayer,
sb: VideoJSPlayer
sb: VideoJSPlayer,
tc: VideoJSPlayer
};
window.loadMediaPlayer = function(data) {

View file

@ -54,6 +54,8 @@ function formatURL(data) {
return data.id;
case "sb":
return "https://streamable.com/" + data.id;
case "tc":
return "https://clips.twitch.tv/" + data.id;
default:
return "#";
}
@ -1284,6 +1286,13 @@ function parseMediaLink(url) {
};
}
if ((m = url.match(/clips\.twitch\.tv\/([A-Za-z]+)/))) {
return {
id: m[1],
type: "tc"
};
}
if((m = url.match(/twitch\.tv\/(?:.*?)\/([cv])\/(\d+)/))) {
return {
id: m[1] + m[2],