博客园批量发闪存,获取小星星
Posted kusy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了博客园批量发闪存,获取小星星相关的知识,希望对你有一定的参考价值。
初步实现代码如下,如果没有小星星,则调下删除的接口来删掉
# -*- coding:utf-8 -*- # __author__ :kusy # __content__:文件说明 # __date__:2018/8/7 16:08 import requests import time def str2json(str,convStr=‘ ‘): d = {} for s in str.split(convStr): s = s.lstrip() if s != ‘‘: subS = s.split(‘:‘) d[subS[0]] = subS[1].lstrip() return d url_add = ‘https://ing.cnblogs.com/ajax/ing/Publish‘ url_del = ‘https://ing.cnblogs.com/ajax/ing/del‘ data_add ={‘content‘:u‘小星星‘,‘publicFlag‘:‘1‘} data_del ={‘ingId‘:‘1412227‘} headers = str2json( ‘‘‘ Connection: keep-alive Accept: application/json, text/javascript, */*; q=0.01 Origin: https://ing.cnblogs.com X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (Khtml, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Content-Type: application/x-www-form-urlencoded Referer: https://ing.cnblogs.com/ Accept-Language: zh-CN,zh;q=0.8 ‘‘‘ ) headers[‘Cookie‘]=‘__guid=46247039.1954902115310474800.1510794105810.6067; 略。。。‘ for i in range(10,100,1): data_add[‘content‘] = u‘小星星‘ + str(i) r = requests.post(url=url_add,data=data_add,headers=headers) print(r.status_code , r.content.decode(‘utf-8‘)) time.sleep(100)
for i in range(5): data_del[‘ingId‘] = 1412328 + (i + 1) r = requests.post(url=url_del,data=data_del,headers=headers) print(r.status_code , r.content.decode(‘utf-8‘))
效果如下(貌似都没有小星星):
以上是关于博客园批量发闪存,获取小星星的主要内容,如果未能解决你的问题,请参考以下文章
python学习--利用session进行博客园登陆并且自动发贴