初步实现代码如下,如果没有小星星,则调下删除的接口来删掉
# -*- coding:utf-8 -*-# __author__ :kusy# __content__:文件说明# __date__:2018/8/7 16:08import requestsimport timedef str2json(str,convStr='\n'): d = {} for s in str.split(convStr): s = s.lstrip() if s != '': subS = s.split(':') d[subS[0]] = subS[1].lstrip() return durl_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'))
效果如下(貌似都没有小星星):