找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 12503|回复: 1

[原创代码] python3使用requests发闪存.py

[复制链接]
发表于 2016-5-9 13:45:36 | 显示全部楼层 |阅读模式
python3使用requests发闪存.py
  1. """
  2. python3使用requests发闪存.py
  3. 2016年5月9日 12:50:40 codegay

  4. 参考资料requests文档:
  5. http://cn.python-requests.org/zh_CN/latest/
  6. """

  7. import requests

  8. url='http://ing.cnblogs.com/ajax/ing/Publish'
  9. head={'Accept':'application/json, text/javascript, */*; q=0.01',
  10.       'Origin':'http://ing.cnblogs.com',
  11.       'X-Requested-With':'XMLHttpRequest',
  12.       'Content-Type':'application/json; charset=UTF-8',
  13.       'DNT':1,
  14.       'Referer':'http://ing.cnblogs.com/',
  15.       'Accept-Encoding':'gzip, deflate',
  16.       'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
  17.       
  18.       }

  19. #session 通过抓包工具,或者cookies工具可以得到.

  20. cookies={'.CNBlogsCookie':'67834BD16E61A87726AF2203F849339E8DEFF67BC4A453FDG830AC373CAC83BAAF2312B975279092095A0E143400E82BBEE189BD5CB8826CA6A6E836F69EC5783C410C2B815A833D5816CEB5B457B159A38F'}#←_←填你自己的session
  21. data={"content":"[天上的星星不说话]python**好{}","publicFlag":1}

  22. s=requests.Session()
  23. for r in range(1,122):
  24.     data['content']="[天上的星星不说话]python**好{}".format(r)
  25.     post=s.post(url,data,cookies=cookies)
  26.     print(post.text)
复制代码
 楼主| 发表于 2016-5-10 03:28:14 | 显示全部楼层
  1. """
  2. python3使用requests删除闪存.py
  3. 2016年5月9日 22:27:30 codegay

  4. 闪存ing.cnblogs.com是一个类似饭否的功能
  5. 本程序功能是删除非幸运闪的闪存

  6. 参考资料requests文档:
  7. http://cn.python-requests.org/zh_CN/latest/
  8. """

  9. import requests
  10. import re


  11. def timeit(fn):
  12.     import time
  13.     def v():
  14.         start=time.clock()
  15.         fn()
  16.         end=time.clock()-start
  17.         print(fn.__name__,"运行耗时:",end)
  18.     return v
  19.         
  20.         
  21.         
  22.         
  23. url='http://ing.cnblogs.com/ajax/ing/GetIngList?IngListType=my&PageIndex=1&PageSize=30'
  24. head={'Accept':'application/json, text/javascript, */*; q=0.01',
  25.       'Origin':'http://ing.cnblogs.com',
  26.       'X-Requested-With':'XMLHttpRequest',
  27.       'Content-Type':'application/json; charset=UTF-8',
  28.       'DNT':1,
  29.       'Referer':'http://ing.cnblogs.com/mobile/',
  30.       'Accept-Encoding':'gzip, deflate',
  31.       'Accept-Language':'zh-CN,zh;q=0.8,en;q=0.6',
  32.       
  33.       }
  34. cookies={'.CNBlogsCookie':'989A8F9SF9SF989S982938492849823498239489284989SDF89S89F8E98F9S88E9R89WER898R989R23423J4K2529R8FS7R2K48978S7DF8'}

  35. s=requests.Session()
  36. @timeit
  37. def geting():
  38.     data={'ingId':'878581'}
  39.     r=s.get(url,cookies=cookies)
  40.     text=r.text
  41.     ingid=re.findall('''feed_content_(\d+)(.+?天上的星星不说话.+?DelIng)''',text,re.DOTALL)
  42.     #ingid=re.findall('''feed_content_(\d+)''',text)
  43.     #print(ingid)   
  44.     notlucky=[a for a,b in ingid if 'ing_icon_lucky' not in b]
  45.     for x in notlucky:
  46.         data['ingId']=x
  47.         try:
  48.             sdel=s.post("http://ing.cnblogs.com/ajax/ing/del",cookies=cookies,data=data)
  49.             print(sdel.text)
  50.         except:
  51.             pass
  52.         
  53. for xxx in range(18):
  54.    
  55.     geting()
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 00:48 , Processed in 0.016537 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表