forked from hoyois/plugin-to-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBild.js
39 lines (34 loc) · 852 Bytes
/
Bild.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
38
39
// Bild killer (2011-09-16)
addKiller("Bild", {
"canKill": function(data) {
return data.src.indexOf('http://www.bild.de/media/') !== -1;
},
"process": function(data, callback) {
var params = parseFlashVariables(data.params.flashvars);
var _this = this;
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://www.bild.de' + params.xmlsrc, true);
xhr.onload = function(event) {
_this.parseResponse(event.target.responseXML, callback);
}
xhr.send(null);
},
"parseResponse": function(response, callback) {
if(response === null) return;
var videos = response.getElementsByTagName('video');
if(videos.length < 1) {
return false;
}
callback({
playlist: [{
poster: videos[0].getAttribute('img'),
sources: [{
url: videos[0].getAttribute('src'),
format: 'H.264',
isNative: true
}]
}],
isAudio: false
});
}
});