猫史档案馆


顶帖神器!!

用户:蒟蒻OIer1048576蒟蒻OIer1048576查看:7 回复:5 评论:7 创建时间:2020-06-03T08:48:20


import requests
from bs4 import BeautifulSoup
from json import loads,dumps


ses = requests.session()
headers = {"Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; ) AppleWebKit/537.36 (KH喵L, like Gecko) Chrome/81.0.4044.138 Safari/537.36"}
print('正在寻找登录密钥...')
soup = BeautifulSoup(requests.get('https://shequ.codemao.cn', headers = headers).text, 'html.parser')
pid = loads(soup.find_all("script")[0].string.split("=")[1])['pid']
print('秘药为:',pid)
print('正在登录')
a = ses.post('https://api.codemao.cn/tiger/v3/web/accounts/login', headers = headers,
                  data = dumps({"identity": "你的手机号", "password": "你的密码", "pid": pid}))
if a.status_code == 200:
    print("登录成功")
else:
    exit("不能登录编程猫")
print('正在顶帖')
postID = int(input("请输入顶贴id - >>>"))
a = ses.post(f'https://api.codemao.cn/web/forums/posts/{postID}/replies', headers = headers,
                          data = dumps({'content': "<p>dd</p>"}))
print("成功" if a.status_code == 201 else "失败")


回复

上一页1 页 / 共 1下一页
千从千从

没看懂

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

喵d

点赞0


评论


陀螺哥陀螺哥

python吗

点赞0


评论


一个STUB用户_6923702一个STUB用户_6923702

while 1:

___ ___

   ·   ·

     ——

点赞0


评论