Created
August 11, 2016 11:43
-
-
Save imfht/9c76f0454bba9d96a17ce98027e031eb to your computer and use it in GitHub Desktop.
一些杂七杂八的脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import time | |
from termcolor import colored | |
#---------------------------------------------------------------------- | |
#使用的是现成的cookie,大概为一次性用品 | |
def test(): | |
"""test""" | |
headers = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Cookie':'SUB=_2AkMgOcBjf8NhqwJRmP0WyW3laIx2wg3EieLBAH7sJRMxHRl-yT83qksDtRBX994ErYChwNsT9GjkBZ4xkFkgxQ..;'} | |
old=0 | |
count = 0 | |
while(1): | |
req = requests.get('http://weibo.com/sephirex?c=spr_qdhz_bd_baidusmt_weibo_s&nick=%CD%F5%CB%BC%B4%CF&is_hot=1',headers=headers) | |
try: | |
new = int(re.findall('他的粉丝\((.*?)\)',req.text)[0]) | |
count+=1 | |
except Exception: | |
print('新浪不让我看我老公') | |
time.sleep(1) | |
continue | |
if new>old: | |
print(colored('[+]%s,你老公的粉丝增加了%d个'%(time.strftime('%H:%M:%S'),new-old),'green')) | |
else: | |
print(colored('[-]%s,你老公的粉丝减少了%d个'%(time.strftime('%H:%M:%S'),old-new),'red')) | |
old = int(re.findall('他的粉丝\((.*?)\)',req.text)[0]) | |
time.sleep(1) | |
if count%60==0: | |
print(count%60+1,'分钟过去了,你老公的粉丝一共增加了',new-old) | |
test() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment