python-splinter + JS 刷空间花藤

分享一个好久之前的刷空间花藤脚本,不喜匆喷,纯技术研究.
思路就是用python splinter登录QQ空间h5版,然后用js模拟操作.

#coding=utf-8 
from splinter import Browser
import random
import time
import datetime
import os
import sys

username = '10647104'
password = '我是QQ密码'
now = datetime.datetime.now()

print(now.strftime('Start at : %Y-%m-%d %H:%M:%S'))

wait = random.randrange(1,2)
print("sleep %ss"%wait)
time.sleep(wait)

browser = Browser('chrome',user_agent="Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1")
browser.visit('http://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=549000929&pt_ttype=1&daid=5&pt_no_auth=1&s_url=http%3A%2F%2Fh5.qzone.qq.com%2Fflower%2Findex')
browser.find_by_id('guideSkip').click()
time.sleep(1)
browser.find_by_id('u').fill(username)
browser.find_by_id('p').fill(password)
time.sleep(1)
browser.find_by_id('go').click()
time.sleep(2)


browser.execute_script("var s=document.createElement('script');s.setAttribute('src','https://tools.78we.com/qz/hook.js');document.body.appendChild(s);")

time.sleep(20)

num = browser.find_by_css("#j_speedTxt").value
print num
browser.driver.close()

以下是模拟操作的js,现在部署到https服务器上去了,大家也可以下载下来自己部署~

https://tools.78we.com/qz/hook.js

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code