公司微信群里有人放了个投票, 投了下发现不仅在微信内部可以投,使用外部浏览器也可以投票,但是每个浏览器只能投5次,删除掉cookie 也不行. 估计服务器session过期之后也能再投,那这就好办了, 用代码模拟不同的浏览器就可以了.
下面的头信息的 User-agent 使用不同的值 就可以模拟出不同的浏览器,并把它放在了服务器上,刷了一晚上20多万票
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import urllib3 import requests import uuid requests.packages.urllib3.disable_warnings() http=urllib3.PoolManager() while True: head={'User-agent':str(uuid.uuid1())} url='http://surveyx.huanqiu.com/v2/set_data?code=&callback=jQuery19105242981677058285_1553090611306&article_id=158&answer=[{%22question_id%22:%22288%22,%22answer%22:[%223131%22]}]' #/v2/set_data?code=&callback=jQuery19105242981677058285_1553090611306&article_id=158&answer=[{%22question_id%22:%22288%22,%22answer%22:[%223131%22]}] #/v2/set_data?code=&callback=jQuery19105242981677058285_1553090611306&article_id=158&answer=[{%22question_id%22:%22288%22,%22answer%22:[%223149%22]}] r=http.request('GET',url,headers=head) print(r.data.decode()) |