youtuber Posted July 23, 2016 Share Posted July 23, 2016 (edited) Hello, have a problem received data error StringRegExpReplace expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <String.au3> Global $aResult, $aNumberofquery $Form1_1 = GUICreate("Form1", 543, 255) $Editkeywordsearch = GUICtrlCreateEdit("", 16, 56, 113, 169) GUICtrlSetData(-1, "word1" & @CRLF & "word2") $EditUrl = GUICtrlCreateEdit("" & @CRLF, 144, 56, 369, 177, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) $list = GUICtrlCreateButton("List", 360, 8, 147, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $list $aReadEditline = StringSplit(StringStripCR(GUICtrlRead($Editkeywordsearch)), @LF) For $aSearchlist = 1 To UBound($aReadEditline) - 1 Searchmylist("/index.php") Next EndSwitch WEnd Func connectWebSite($address) $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oMyError = ObjEvent("AutoIt.Error", "httperror") $oHTTP.Open("POST", $address, False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0") $oHTTP.SetRequestHeader("Accept-Language", "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") $oHTTP.Send("name=" & $aReadEditline[$aSearchlist] & "&catacory=catacory2") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aReadEditline[$aSearchlist] = ' & $aReadEditline[$aSearchlist] & @CRLF & '>Error code: ' & @error & @CRLF) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode = 200 Then Return $oReceived Else Return -1 EndIf EndFunc Func httperror() ConsoleWrite("error http" & @CRLF) EndFunc Func Searchmylist($query) $connected = False $url = "http://youtubertr.com" & $query $response = connectWebSite($url) If $response <> -1 Then $connected = True EndIf If $connected Then $response = BinaryToString($response, 4) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $response = ' & $response & @CRLF & '>Error code: ' & @error & @CRLF) $aNumberofquery = StringRegExpReplace($response, "(?i).+z:\h*<b>(\d+?)<\/b><br.*", "$1") If $aNumberofquery < 1 Then Searchmylist($query) Else $aReceivedData = StringRegExp($response, '(?i)title="(http://.+?)"\hrel', 3) For $z = 0 To UBound($aReceivedData) - 1 If StringInStr($aReceivedData[$z], "://") Then $Link = $aReceivedData[$z] $aResult &= $Link & @CRLF GUICtrlSetData($EditUrl, $aResult & @CRLF, 1) EndIf Next EndIf Else ConsoleWrite("Could not connect") Searchmylist($query) EndIf EndFunc Edited July 23, 2016 by youtuber Link to comment Share on other sites More sharing options...
mikell Posted July 23, 2016 Share Posted July 23, 2016 Difficult to answer because you didn't post the concerned html source code But I strongly suspect that the (?s) option could help If this doesn't work, please post the html youtuber 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now