用户:
飞熊jSrt查看:268 回复:10 评论:51 创建时间:2023-08-30T14:15:19
大概是调api吧,但我不会找啊,找了也不会调啊,调了也不会登录啊wwww
PXstate建议先有点前端请求基础再学requests,不然有点难懂,csdn搜requests
点赞0
评论
有基础,统计过灌水前90页所有用户发帖数目,并小炫一下在控制台打了一份柱状图()
我的当时发了79个贴,比第二高了39左右()
自动回复也差不多,不过你那个应该是Get请求,不需要携带cookie参数
但是api怎么扒()我只会找url()
api就是url,F12,点网络,先清空,然后操作,就会显示这个操作发出的请求,找到有用的请求,把里面的参数写在requests
纯文字有点难表达
原来我概念混了()
或者说api是属于url还是就是它本身
网络英文是啥()
api属于url
Edge浏览器空白页地址栏会有灰字,写着键入url,这的url就是网址链接
看来我的理解尚且经得住推敲()
?.
https://shequ.cod喵/community/429585 你看下这个
这个自动评论很多人都很讨厌,我之前做过一个,现在都不敢用
找不到()
什么找不到
网络()
什么浏览器
谷歌
network
https://api.cod喵/web/forums/posts/ /replies
下一步怎么办啊啊
你这是论坛评论的api?
是(
https://api.cod喵/nemo/v2/works/ /like https://api.cod喵/nemo/v2/works/ /collection
你知道cookies、header、data吗
https://api.cod喵/nemo/v2/works/197147946/fork
前面知道,中间见过
requests.post(url=url,headers=headers,data=data)这样写
api不能直接访问哎(?
要写请求头和负载参数
data怎么填啊(
Payload这个选项里面写了
但是请求失败
发下你写的代码(记得把cookie删掉)
发不出啦啊啊啊啊啊嗷嗷
单独发个评论,放在bcm自带的代码框
对啊
发不出来
???
PXstate ??点赞0
评论
headers = { "Content-Type":"application/json", "User-Agent":'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:65.0) Gecko/20100101 Firefox/65.0', 'cookie': cookie }
p = post('https://api.cod喵/nemo/v2/works/%d/like' % (197147946), headers=headers, data={}) print(p.json())
尖端放电varsleep=(delay)=>newPromise((resolve)=>setTimeout(resolve,delay)); if(!localStorage.getItem("liked")){ localStorage.setItem("liked","[]"); }; varliked=JSON.parse(localStorage.getItem("liked")); asyncfunctionget_newest(){ letnewest_xhr=newXMLHttpRequest() newest_xhr.open('GET','https://api.cod喵/creation-tools/v1/pc/discover/newest-work?work_origin200_type=ORIGINAL_WORK&offset=0&limit=20')//初始化一个请求 newest_xhr.send()//发送请求 newest_xhr.onload=function(){ //console.log(this.responseText) result=JSON.parse(this.responseText) } newest_xhr.onerror=function(){ console.log(this.responseText) result=-1 } letresult=0; while(result==0){ awaitsleep(1) } returnresult }; asyncfunctionlike(id){ console.log(id) letlike_xhr=newXMLHttpRequest() like_xhr.withCredentials=true; like_xhr.open('POST','https://api.cod喵/nemo/v2/works/'+id+'/like')//初始化一个请求 like_xhr.setRequestHeader("Content-Type","application/json;charset=UTF-8"); like_xhr.setRequestHeader("User-Agent",navigator.userAgent); like_xhr.setRequestHeader("Cookie",document.cookie); like_xhr.send()//发送请求 like_xhr.onload=function(){ console.log(this.responseText) result=this.responsetext } like_xhr.onerror=function(){ console.log(this.responseText) result=-1 } letresult=0; while(result==0){ awaitsleep(1) } returnresult }; //main_function (asyncfunction(){ while(1){ newest=awaitget_newest() console.log(newest); if(newest){ for(letnewest_count=0;newest_count<newest.limit;newest_count++){ like(newest.items[newest_count].work_id) awaitsleep(50) } } }; })();
点赞0
评论
就是这样