- """
- python3使用requests删除闪存.py
- 2016年5月9日 22:27:30 codegay
-
- 闪存ing.cnblogs.com是一个类似饭否的功能
- 本程序功能是删除非幸运闪的闪存
-
- 参考资料requests文档:
- http://cn.python-requests.org/zh_CN/latest/
- """
-
- import requests
- import re
-
-
- def timeit(fn):
- import time
- def v():
- start=time.clock()
- fn()
- end=time.clock()-start
- print(fn.__name__,"运行耗时:",end)
- return v
-
-
-
-
- url='http://ing.cnblogs.com/ajax/ing/GetIngList?IngListType=my&PageIndex=1&PageSize=30'
- head={'Accept':'application/json, text/javascript, */*; q=0.01',
- 'Origin':'http://ing.cnblogs.com',
- 'X-Requested-With':'XMLHttpRequest',
- 'Content-Type':'application/json; charset=UTF-8',
- 'DNT':1,
- 'Referer':'http://ing.cnblogs.com/mobile/',
- 'Accept-Encoding':'gzip, deflate',
- 'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
-
- }
- cookies={'.CNBlogsCookie':'989A8F9SF9SF989S982938492849823498239489284989SDF89S89F8E98F9S88E9R89WER898R989R23423J4K2529R8FS7R2K48978S7DF8'}
-
- s=requests.Session()
- @timeit
- def geting():
- data={'ingId':'878581'}
- r=s.get(url,cookies=cookies)
- text=r.text
- ingid=re.findall('''feed_content_(\d+)(.+?天上的星星不说话.+?DelIng)''',text,re.DOTALL)
- #ingid=re.findall('''feed_content_(\d+)''',text)
- #print(ingid)
- notlucky=[a for a,b in ingid if 'ing_icon_lucky' not in b]
- for x in notlucky:
- data['ingId']=x
- try:
- sdel=s.post("http://ing.cnblogs.com/ajax/ing/del",cookies=cookies,data=data)
- print(sdel.text)
- except:
- pass
-
- for xxx in range(18):
-
- geting()
复制代码
|