-
-
Save CMGS/35c777fd72d968bb2998 to your computer and use it in GitHub Desktop.
This file contains 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
# coding: utf-8 | |
import gevent | |
from gevent import monkey; monkey.patch_all() | |
import time | |
from requests import Session | |
ans = { | |
u'92和160哪个数大?(请填数值)':'160', \ | |
u'55和200哪个数大?(请填数值)':'200', \ | |
u'700和222哪个数大?(请填数值)':'700', \ | |
u'88和980哪个数大?(请填数值)':'980' | |
} | |
CAR = 'dffx' | |
headers = { | |
'Referer': 'http://ms.autohome.com.cn/miaosha/201511/%s/' % CAR, | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36' | |
} | |
session = Session() | |
_item_id = 1079 | |
_mscode = '8878' | |
_mobile = '13975885223' | |
session.get('http://ms.autohome.com.cn/miaosha/service/login.ashx?itemId=%s&mobile=%s&mscode=%s' % (_item_id, _mobile, _mscode), headers=headers) | |
def go(): | |
r = session.get('http://ms.autohome.com.cn/miaosha/201511/%s/question.ashx?itemId=%s' % (CAR, _item_id), headers=headers) | |
r = r.content.decode('gbk') | |
answer = ans.get(r) | |
if not answer: | |
print r | |
r = session.get('http://ms.autohome.com.cn/miaosha/service/seckill.ashx?itemId=%s&answer=%s' % (_item_id, answer), headers=headers) | |
print r.content.decode('gbk') | |
while True: | |
gevent.spawn(go) | |
time.sleep(0.001) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment