Skip to content

Instantly share code, notes, and snippets.

@xavierskip
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavierskip/1c5e6c4e84f22ff3974c to your computer and use it in GitHub Desktop.
Save xavierskip/1c5e6c4e84f22ff3974c to your computer and use it in GitHub Desktop.
weibo statistics.
//document.body.appendChild(document.createElement('script')).src='http://code.jquery.com/jquery-1.9.1.min.js';
// get content
var wl=[];
// Manual page
var tl = document.getElementsByClassName("WB_text")
for(var i=0;i<tl.length;i++){
wl.push(tl[i].innerText);
};
var wb = wl.join('').replace(/http:\/\/t\.cn\/[a-zA-Z0-9]+/g,'');
// get time
var wt = new Array(24);
var wd = new Array(7);
for(var i=0;i<24;i++){
wt[i]=0
};
for(var i=0;i<7;i++){
wd[i]=0;
}
// Manual page
var wf = document.getElementsByClassName("WB_detail");
for(var i=0;i<wf.length;i++){
var t = new Date(wf[i].lastElementChild.querySelector('a').title);
wt[t.getHours()] += 1;
wd[t.getDay()] += 1;
}
// wt
[19, 8, 1, 2, 1, 1, 0, 3, 3, 6, 2, 9, 13, 14, 8, 5, 6, 8, 9, 6, 9, 11, 36, 30]
var c=0;wt.forEach(function(e){c+=e});
// c = 210
//wd
[28, 29, 20, 35, 27, 36, 35]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment