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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| console.log("运行中,请保持网络通畅及时间充足,运行时可切到其他页面") var av = window.__INITIAL_STATE__.aid;
var csrf = getCookie("bili_jct");
var kill_list = new Array(); var str = prompt('请输入匹配的关键字','罕见'); function sleep (time) { return new Promise((resolve) => setTimeout(resolve, time)); }
function getCookie(name){ var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)){ return arr[2];} else{ return null;} } function find_reply (av,pn) { kill_list[pn] = new Array(); var api = 'https://api.bilibili.com/x/v2/reply?type=1&oid=' + av + '&ps=49&pn=' + pn + '&sort=1&nohot=1'; $.ajax({ url: api, type: 'GET', contentType:false, processData:false, xhrFields: { withCredentials: true }, success: function (data) { if (data.code == 0){ for (i = 0, j = 0; i < 48; i++){ try{ var r = data.data.replies[i].content.message; var find1 = r.search(str); if (find1 !== -1 || find2 !==-1 ) { kill_list[pn][j] = data.data.replies[i].rpid; j++; console.log(data.data.replies[i].content.message); } else{ continue; } } catch(e){ console.log("是友善的评论捏🥰"); logMyErrors(e); } finally{ continue; } } console.log("\n已找到" + kill_list[pn].length + "条呃呃评论\n"); } else { console.log("失败,原因:"+data.message); } } }) } for (pn = 1; pn < 10; pn++) { await sleep(7000); console.log("\n第" + pn + "页已检索完成\n"); find_reply(av, pn); } for (pn = 1; pn<kill_list.length; pn++){ console.log("开始举办第"+pn+"页呃呃评论"); for (i = 0 ; i < kill_list[pn].length; i++){ try{ await sleep(100000); url = 'https://api.bilibili.com/x/v2/reply/report?type=1&reason=4&oid=' + av + '&rpid='; url_a = url + kill_list[pn][i]; var formdata =new FormData(); formdata.append("oid",av); formdata.append("type",1); formdata.append("rpid",kill_list[pn][i]); formdata.append("content",""); formdata.append("reason",4); formdata.append("ordering","heat"); formdata.append("jsonp","jsonp"); formdata.append("csrf",csrf); $.ajax({ url: url_a, type: 'POST', data: formdata, contentType:false, processData:false, xhrFields: { withCredentials: true }, success: function (data) { if (data.code == 0){ console.log("已成功举办第" + i + "条评论"); } else{ console.log("第"+i+"条评论举办失败,原因:"+data.message); } if ( i == kill_list[pn].length){ console.log("已全部举办完成,辛苦了🥰部分评论没有举办成功,果咩😥"); } }, error: function (data) { console.log("果咩,出错了😢,原因:\n"); console.log(data); } }) } catch(e){ console.log("出错了😥"); logMyErrors(e); } finally{ continue; } } } console.log("END");
|