码迷,mamicode.com
首页 > 其他好文 > 详细

博客园批量发闪存,获取小星星

时间:2018-08-07 18:51:19      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:time   分享图片   date   java   bsp   alt   headers   code   publish   

初步实现代码如下,如果没有小星星,则调下删除的接口来删掉

# -*- coding:utf-8 -*-
# __author__ :kusy
# __content__:文件说明
# __date__:2018/8/7 16:08
import requests
import time


def 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 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))

 

技术分享图片

 

 效果如下(貌似都没有小星星):

技术分享图片

 

博客园批量发闪存,获取小星星

标签:time   分享图片   date   java   bsp   alt   headers   code   publish   

原文地址:https://www.cnblogs.com/kusy/p/9438564.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!