#include <array.au3>
;//获取主页源码
$sSource = _Get_Source()
;//快3
$aQrevqck3 = StringRegExp(StringRegExpReplace($sSource,'(?is)(.+?)(<h\d+>快3</h\d+>.*?bulletin/prevqck3.html)(.+)','${2}'),'(?im)<li>(\d+)',3)
If Not @error Then _ArrayDisplay($aQrevqck3,'快3')
;//PK10
$aPK10 = StringRegExp(StringRegExpReplace($sSource,'(?is)(?is)(.+?)(pk10_bg.*?</div>)(.+)','${2}'),'(?im)<li>(\d+)',3)
If Not @error Then _ArrayDisplay($aPK10,'PK10')
;//快乐8
$aKl8 = StringRegExp(StringRegExpReplace($sSource,'(?is)(?is)(.+?)(kl8_bg.*?</div>)(.+)','${2}'),'(?im)<li>(\d+)',3)
If Not @error Then _ArrayDisplay($aKl8,'快乐8')
Func _Get_Source()
Local $sGetUrl = 'http://www.bwlc.net/'
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open('GET', $sGetUrl , True)
If @error Then Return SetError(-1)
$oHTTP.Option(4) = 13056 ;忽略错误标志
$oHTTP.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0")
$oHTTP.setRequestHeader("Host", "www.bwlc.net")
$oHTTP.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
$oHTTP.setRequestHeader("Accept-Language", "zh-CN,zh;q=0.8")
$oHTTP.setRequestHeader("Upgrade-Insecure-Requests", "1")
$oHTTP.setRequestHeader("Connection", "keep-alive")
$oHTTP.setRequestHeader("Cache-Control","max-age=0")
$oHTTP.send()
If @error Then Return SetError(-2)
$oHTTP.WaitForResponse
If @error Then Return SetError(-3)
$sContent = $oHTTP.responsebody
If @error Then Return SetError(-4)
$oHTTP = 0
Return BinaryToString($sContent, 4)
EndFunc
|