-
Notifications
You must be signed in to change notification settings - Fork 24
/
Katu.js
27 lines (24 loc) · 811 Bytes
/
Katu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
addKiller("Katu", {
"canKill": function(data) {
return /^https?:\/\/www.katu.com\//.test(data.location) && /^fin_videoplayer_/.test(data.params.id);
},
"process": function(data, callback) {
var videoID = /^fin_videoplayer_([\d_]*)/.exec(data.params.id)[1];
var xhr = new XMLHttpRequest();
xhr.open("GET", data.location, true);
xhr.addEventListener("load", function() {
try{
var config = new RegExp("fin_story_media\\['" + videoID + "'\\] = ([^;]*)").exec(xhr.responseText)[1];
var file = /file: '([^']*)',/.exec(config)[1];
var image = /image: '([^']*)',/.exec(config)[1];
} catch(e) {
return;
}
callback({"playlist": [{
"sources": [{"url": file, "format": "MP4", "isNative": true}],
"poster": image
}]});
},false);
xhr.send();
}
});