Skip to content

Instantly share code, notes, and snippets.

@shugen002
Last active March 3, 2020 02:34
Show Gist options
  • Save shugen002/5e51ce9e4c5ab331f45c67c61ca7dcf7 to your computer and use it in GitHub Desktop.
Save shugen002/5e51ce9e4c5ab331f45c67c61ca7dcf7 to your computer and use it in GitHub Desktop.
拉取半年内所有礼物流水
var done=true;
var dateoffset=0;
var result=[];
var offset=""
var today=new Date();
function getpage(date,next_offset){
done=false;
bilibiliEvolved.Ajax.getJsonWithCredentials("https://api.live.bilibili.com/gift/v1/master/getReceivedGiftList?coin_type=&gift_id=&begin_time="+date+"&uname=&next_offset="+offset+"&page_size=20").then((e)=>{
e.data.list.forEach((v)=>{result.push(v)});
if(e.data.has_more){
offset=e.data.next_offset;
}else{
offset="";
dateoffset+=24*60*60*1000;
}
done=true;
}).catch(console.log);
}
function tick(){
if(done){
getpage((new Date(today-dateoffset)).toISOString().replace(/(\d*)-(\d*)-(\d*).*/,"$1$2$3"),offset);
}
}
setInterval(tick,100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment