bilibili直播自动签到

作者 by Tokeii / 2021-12-21 / 暂无评论 / 519 个足迹

import requests

url = "https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign"
#这里填自己B站的cookies
bilibilicookies = ' '

payload={}
headers = {
  'authority': 'api.live.bilibili.com',
  'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"',
  'accept': 'application/json, text/plain, */*',
  'sec-ch-ua-mobile': '?0',
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62',
  'sec-ch-ua-platform': '"Windows"',
  'origin': 'https://link.bilibili.com',
  'sec-fetch-site': 'same-site',
  'sec-fetch-mode': 'cors',
  'sec-fetch-dest': 'empty',
  'referer': 'https://link.bilibili.com/p/center/index?spm_id_from=333.1007.0.0',
  'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
  'cookie': '{0}'.format(bilibilicookies)
}

response = requests.request("GET", url, headers=headers, data=payload)
signname='bilibili直播'
bilibilisigin=response.json()['message']
#通过server酱推送逆袭
serverchanapi='https://sctapi.ftqq.com/***********.send?title={0}'.format(signname+','+bilibilisigin)
responsesc= requests.request("GET", serverchanapi)

独特见解