-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (22 loc) · 741 Bytes
/
Copy pathapp.js
File metadata and controls
27 lines (22 loc) · 741 Bytes
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
var Browser = require('zombie'),
assert = require('assert'),
fs = require('fs'),
h2j = require('html-to-js'),
read = fs.readFileSync;
var html = read(__dirname+'/public/2nd.html','utf-8');
var parser = require('html-parser');
objs =[];
var sanitized = parser.sanitize(html, {
elements: [ '!--','div' ,'span','object','ul','li','meta','link','style','a','p','canvas'],
attributes: [ 'data'['gamecast'] ],
comments: false
});
parser.parse(sanitized, {
cdata: function(value) { objs.push(value) },
});
var data = objs[4];
var str = data.toString();
str = str.slice(str.indexOf('{')-1,str.length-2);
str=str.substr(0,str.lastIndexOf(';'));
var json = eval("("+str+")");
console.log(json['data'].gamecast.stats.player);