小白一枚測驗B站評論發送
發現不管怎么搞都是校驗失敗


直接上代碼,希望有大神指點一下
import requests
import time
import random
class SendDate:
def __init__(self):
self.url ='https://api.bilibili.com/x/v2/reply/add'
self.cookie={'Cookie':"_uuid=18B49EF2-6260-3B62-A2B4-3CEAA20B45FC43463infoc; buvid3=76B9C6CB-248F-4D30-9028-D0B5B6E9DBF3155834infoc; LIVE_BUVID=AUTO1415743181463309; sid=j8opiv58; CURRENT_FNVAL=16; stardustvideo=1; rpdid=|(J~R~|m~mml0J'ul~llulYRY; im_notify_type_483881790=0; im_notify_type_483899016=0; im_notify_type_501743820=0; CURRENT_QUALITY=64; DedeUserID=370642657; DedeUserID__ckMd5=d9343ff9801f4069; SESSDATA=https://bbs.csdn.net/topics/a8454499%2C1583397856%2C7412c021; bili_jct=a9c61e9f957cc34271b86c75cc0f8cf5; im_notify_type_370642657=0"}
self.header={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36'}
def Send(self,dat):
self.html=requests.post(self.url, json=dat, headers=self.header,cookies=self.cookie)
print(self.html.status_code)
print(self.html.text)
send=SendDate()
dat={
'oid': '22119850',
'type': '1',
'message': '棒棒的',
'plat': '1',
'jsonp': 'jsonp',
'csrf': 'a9c61e9f957cc34271b86c75cc0f8cf5'}
send.Send(dat)
uj5u.com熱心網友回復:
同問,代碼和別人一樣,別人沒什么問題,到我這就csrf校驗失敗轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/36766.html
上一篇:為什么不能爬取多頁,請教大佬們
下一篇:請教一下各位大神
