forked from hoyois/plugin-to-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Zeit.js
37 lines (33 loc) · 941 Bytes
/
Zeit.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
28
29
30
31
32
33
34
35
36
37
/**
* @link zeit.de
*/
addKiller("Zeit", {
"canKill": function(data) {
return /^http:\/\/video\.zeit\.de/.test(data.params.linkbaseurl);
},
"process": function(data, callback) {
var _this = this;
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://www.zeit.de/website-solr/select/?q=uuid:%22' + data.params.linkbaseurl + '%22&version=2.2&indent=on&wt=json&fl=id,title,created,teaser_text,date-last-modified,referenced,h264_url,graphical-preview-url-large', true);
xhr.onload = function(event) {
_this.parseResponse(event.target.responseText, callback);
}
xhr.send(null);
},
"parseResponse": function(response, callback) {
var json = JSON.parse(response);
if(json.response.docs.length < 1) {
return false;
}
callback({
playlist: [{
poster: json.response.docs[0]['graphical-preview-url-large'],
sources: [{
url: json.response.docs[0].h264_url,
format: 'H.264',
isNative: true
}]
}]
});
}
});