set WshShell=WScript.CreateObject("WScript.Shell")
Const user = "hugetech2"
Const pwd = "huge204204"
Const pid = "2127"
Const mobilePwd = "basketball123"
Dim userToken
Dim mobile
Dim identify
identify = "0"
'登陆api网站,获取用户token
function getUserToken()
Dim ie2
Set ie2 = CreateObject("InternetExplorer.Application")
ie2.navigate "http://api.jmyzm.com/http.do?action=loginIn&uid="&user&"&pwd="&pwd
Wscript.sleep 2000
userReturn = ie2.document.getElementsByTagName("body")(0).innerHTML
userReturnArray = split(userReturn, "|")
userToken = userReturnArray(1)
'msgbox userToken
end function
'获取手机号
function getMobile()
Dim ie3
Set ie3 = CreateObject("InternetExplorer.Application")
ie3.navigate "http://api.jmyzm.com/http.do?action=getMobilenum&pid="&pid&"&uid="&user&"&token="&userToken
Wscript.sleep 5000
mobileReturn = ie3.document.getElementsByTagName("body")(0).innerHTML
mobileReturnArray = split(mobileReturn, "|")
mobile = mobileReturnArray(0)
'msgbox mobile
end function
'获取验证码
function getIdentify()
Dim ie4,flag
Set ie4 = CreateObject("InternetExplorer.Application")
ie4.navigate "http://api.jmyzm.com/http.do?action=getVcodeAndReleaseMobile&uid="&user&"&token="&userToken&"&mobile="&mobile
Wscript.sleep 5000
identifyReturn = ie4.document.getElementsByTagName("body")(0).innerHTML
identifyReturnArray = split(identifyReturn, "|")
flag = 0
do while flag<50
if identifyReturnArray(0) = mobile Then
identifyAll = identifyReturnArray(1)
if Mid(identifyAll,1,3) = "验证码" Then
identify = Mid(identifyAll,5,6)
else
identify = Mid(identifyAll,11,6)
end if
exit do
Else
Wscript.sleep 5000
Dim ieTemp
Set ieTemp = CreateObject("InternetExplorer.Application")
ieTemp.navigate "http://api.jmyzm.com/http.do?action=getVcodeAndReleaseMobile&uid="&user&"&token="&userToken&"&mobile="&mobile
Wscript.sleep 3000
identifyReturn =ieTemp.document.getElementsByTagName("body")(0).innerHTML
identifyReturnArray = split(identifyReturn, "|")
End if
flag = flag+5
loop
end function
'注册账号第一步:登陆直播间,进入注册界面
function register1()
Dim ie_1
Set ie_1 = CreateObject("InternetExplorer.Application")
ie_1.visible=true
ie_1.navigate "http://m.yy.com/room/14495179/?f=6308"
Wscript.sleep 2000
ie_1.document.getElementById("navRegister").Click
Wscript.sleep 1000
ie_1.document.getElementById("yyRegister").Click
Wscript.sleep 1000
end function
'注册账号第二步:填写注册信息,发送短信
function register2()
Dim ie_2
Set ie_2 = CreateObject("InternetExplorer.Application")
ie_2.visible=true
ie_2.navigate "https://aq.yy.com/p/reg/mobile.do?appid=5623&action=2&busiurl=http%3A%2F%2Fm.yy.com%2F%3Ff%3D6308%26cpuid%3D0%26dhz%3D1&fromadv=myy_6308.cpuid_0.channel_14495179&reqDomainList="
Wscript.sleep 5000
ie_2.document.getElementsByTagName("a")(3).Click
for i=0 to 6
Wscript.sleep 500
WshShell.SendKeys "{Tab}"
next
WshShell.SendKeys mobile
WshShell.SendKeys "{Tab}"
Wscript.sleep 500
WshShell.SendKeys mobilePwd
WshShell.SendKeys "{Tab}"
Wscript.sleep 500
WshShell.SendKeys mobilePwd
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Enter}"
Wscript.sleep 20000
getIdentify()
Wscript.sleep 2000
WshShell.SendKeys "^4"
WshShell.SendKeys "{Tab}"
Wscript.sleep 1000
if identify <> "0" Then
WshShell.SendKeys identify
Wscript.sleep 500
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Enter}"
Else
MsgBox "fail to get identify"
End if
end function
'关闭浏览器,并且再次启动
function closeWeb()
Set ws = CreateObject("Wscript.Shell")
ws.run "taskkill /f /im 360se.exe",vbhide
Wscript.sleep 2000
ws.run "C:\Users\HugeTech7\Desktop\mytest.vbs"
End Function
'开始执行
for i=0 to 5
getUserToken
Wscript.sleep 2000
getMobile
Wscript.sleep 2000
register1
register2
msgbox "账号注册成功,账号是:"&mobile&"密码是:"&mobilePwd
Wscript.sleep 5000
closeWeb
next