HP Quelltext, _FileRead, Dateien zusammenfügen, wer hilft mir??

  • Ich habe mir den Quelltext von Seiten mit Proxy Servern mit "HTTrack Website Copier" auf Platte geladen.
    Nun wollte ich mit der "getUrl.au3" aus dem Quelltext der Seite nur die Proxy-Server-Adressen raussuchen.
    Klappt auch schon, nur bei grossen Dateien zeitaufwändig!

    Danach wollte ich alle ProxyListen zu einer zusammenfügen, was ich nicht geschafft hab..immer .txt leer! ?(
    Mit "_callHP" möchte ich (am besten unsichtbar) über alle Proxys eine bestimmte Webseite aufrufen und
    nach vollständigem laden beenden.

    Probleme: Lange Arbeitszeit beim suchen von Adressen
    zusammenfügen von .txt Dateien funzt nicht
    Proxy-Server werden sichtbar aufgerufen
    nicht auf allen Proxy-Servern funzt die Eingabe der Ziel-Seite


    Dateien im Anhang! :D


    Bin dankbar für jeden Rat!

  • Du bekommst mit:

    [autoit]

    $aAdressen=Stringregexp(Fileread(DATEI),'<td class="pthtd"><a target="_blank" href="(.+)">')

    [/autoit]


    einen Array mit den Adressen. Ein Port war nicht angegeben sonst musste nochmal schauen,
    ob der immer gleich ist oder der irgendwo auf der Seite angegeben ist.

    mit:

    [autoit]

    For $i=0 to Ubound($aAdressen)-1;Falls der erste Eintrag (0) nur die Anzahl ausgibt muss $i am Anfang=1 sein
    Filewrite(DateifuerProxies,$aAdressen[$i])
    next

    [/autoit]


    schreibst du alle Proxies in eine Datei.
    Alles ist ungetestet, sollte aber dennoch funktionieren :rolleyes: .

    Wer immer nur das tut, was er bereits kann - wird auch immer nur das bleiben, was er bereits ist!

  • [autoit]


    $Matchtxt = FileOpen("Match.txt",2)
    For $i = 1 to 5
    $aRegExp = StringRegExp(FileRead("webproxy"&$i&".html"),'"((http://www\.|http://).+?\..+?\/)"',4)
    For $x = 0 to UBound($aRegExp)-1
    $dummy = $aRegExp[$x]
    FileWriteLine($Matchtxt,$dummy[1])
    Next
    Next
    FileClose($Matchtxt)

    [/autoit]

    So sollte deine getURL.au3 funktionieren.

    Zitat von Morrison

    Proxy-Server werden sichtbar aufgerufen

    Man beachte den 3ten Parameter ($f_visible). Wenn du es so aufrufst, ist es auch unsichtbar

    [autoit]

    $oIE = _IECreate($url, 0, 0)

    [/autoit]
  • Hi!


    Das mit getHP iss schon sehr gut! Danke! :rock:


    Aber warum ist die Match.txt leer?? : :huh:


    [autoit]

    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    ;#Include <_TextLookup.au3>
    ;
    Dim $Dir = ("*.html")
    Dim $FileList[500]
    Dim $file = "found.txt"
    $anzahl = _FileCountLines($file)
    $line = 1
    _Dir($Dir)
    For $i = 1 to $anzahl
    $Dat = FileReadLine($file, $line)
    $line +=1
    _TextLookup($Dat)
    $rest = $anzahl - $i
    ToolTip($rest & " Dats left")
    Next

    [/autoit][autoit][/autoit][autoit]

    ;
    func _Dir($Dir)
    $foundtxt = FileOpen("found.txt",2)
    ; Shows the filenames of all files in the current directory.
    $search = FileFindFirstFile($Dir)
    $loopcount = 0
    ; Check if the search was successful
    If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
    EndIf
    ;
    While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    FileWriteLine($foundtxt, $file)
    ;_ArrayAdd($FileList, $file) ; add found to .txt
    ;MsgBox(4096, "File:", $file)
    $loopcount +=1
    WEnd
    ; Close the search handle
    FileClose($foundtxt)
    FileClose($search)
    EndFunc ;_Dir($Dir)
    ;
    ;
    func _TextLookup($Dat)
    $Matchtxt = FileOpen("Match.txt",2)
    $aRegExp = StringRegExp(FileRead($Dat),'"((http://www\.|http://).+?\..+?\/)"',4)
    For $x = 0 to UBound($aRegExp) -1
    $dummy = $aRegExp[$x]
    FileWriteLine($Matchtxt,$dummy[1])
    Next
    FileClose($Matchtxt)
    EndFunc ;_TextLookup(Dat)
    ;
    ;FileClose($Matchtxt)

    [/autoit]
  • Hab mir mal erlaubt ein bisschen zu kürzen :P

    Spoiler anzeigen
    [autoit]

    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    ;#Include <_TextLookup.au3>
    Global $foundtxt
    _FileReadToArray("found.txt",$foundtxt)
    FileDelete("Match.txt")
    For $i = 1 to $foundtxt[0]
    _TextLookup($foundtxt[$i])
    ToolTip($foundtxt[0] - $i & " Dats left")
    Next

    [/autoit] [autoit][/autoit] [autoit]

    func _TextLookup($Dat)
    $Matchtxt = FileOpen("Match.txt",1)
    $aRegExp = StringRegExp(FileRead($Dat),'"((http://www\.|http://).+?\..+?\/)"',4)
    For $x = 0 to UBound($aRegExp) -1
    $dummy = $aRegExp[$x]
    FileWriteLine($Matchtxt,$dummy[1])
    Next
    FileClose($Matchtxt)
    EndFunc ;_TextLookup(Dat)

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Probier mal das hier: habe den RegEx noch ein wenig verbessert, und die Proxyliste kann jetzt vom script aktualisiert werden. Natürlich gibts noch verbesserungspotential (und ich glaube der regex hat noch irgendwo einen fehlerHab den Fehler im RegExp jetzt ausgebessert. Jetzt bekommt er die Volle anzahl an Proxies angezeigt.)

    Spoiler anzeigen
    [autoit]

    #include <file.au3>
    #include <array.au3>
    #include <string.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;Aktualisiert die Proxy Liste
    _GetProxyList(5) ;kannst du natürlich auch auskommentieren.

    [/autoit] [autoit][/autoit] [autoit]

    Global $a_foundtxt
    _FileReadToArray("found.txt", $a_foundtxt)

    [/autoit] [autoit][/autoit] [autoit]

    FileDelete("Match.txt")
    For $i = 1 To $a_foundtxt[0]
    _TextLookup($a_foundtxt[$i])
    ToolTip($a_foundtxt[0] - $i & " Dats left")
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Func _TextLookup($Dat)
    $Matchtxt = FileOpen("Match.txt", 1)
    $aRegExp = StringRegExp(FileRead($Dat), '("(http://www\.|http://)[\-a-z0-9]+(\.[a-z]+){1,2}(\"|\/\"|\/[\-a-z0-9]+\/"))', 4)
    For $x = 0 To UBound($aRegExp) - 1
    $dummy = $aRegExp[$x]
    FileWriteLine($Matchtxt, StringReplace($dummy[1], '"', ''))
    ConsoleWrite(StringReplace($dummy[1], '"', '') & @CRLF)
    Next
    FileClose($Matchtxt)
    EndFunc ;==>_TextLookup

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetProxyList($pages = 5)
    ;aktualisiert die Proxy-liste. Standart: 5 Seiten
    If $pages = -1 Then $pages = 5
    $h_foundtxt = FileOpen("found.txt", 2)
    For $i = 1 To $pages
    InetGet("http://www.proxy4free.com/list/webproxy" & $i & ".html", "webproxy" & $i & ".html")
    FileWriteLine($h_foundtxt, "webproxy" & $i & ".html")
    Next
    FileClose($h_foundtxt)
    EndFunc ;==>_GetProxyList

    [/autoit]

    EDIT: hab mal meien Match.txt angehängt. Volle 150 Treffer ^^

  • Ich raffs nich :?: :huh:

    ...wieso ist meine Match.txt leer?!?

    Hab Dein Code übernommen, funzt aber nicht..was kann das nu sein?

    Versionsprobleme?? Hatte vorher die lite Version und jetzt des neue SciTE drüberinstalliert.

    ?(

  • Werden die Proxies nichtmal in der Scite konsole angezeigt? Und nein, an scite kanns nicht liegen. Du kannst autoit scripte ja auch mit nem editor programmieren...

    PS: Benutz mal bitte

    [autoit]

    _GetProxyList(10)

    [/autoit]

    werden dann auch WebProxy1-10.html erstellt? Sind sie auch in der found.txt vorhanden?

  • Käy, des Script funzt. :thumbup: .hatte da was durcheinander gebracht. :rolleyes:
    Danke für die Hilfe! 8o


    Wie würde der StringRegExp Ausdruck heissen wenn dies die Quelle:

    <optionvalue="81d.info">81d.info&nbsp;&nbsp;(US, Glype)

    und dies:

    http://http://www.81d.info

    das Ergebnis sein soll? :huh:


    Meine "GetProxyList.au3":

    Spoiler anzeigen
    [autoit]


    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    #include <IE.au3>
    ;
    ;
    Global $a_foundtxt
    FileDelete("Match.txt")
    ;Main
    ;
    ;Proxy-Liste
    #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=None
    If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox(4,"Proxy-Liste","Proxy-Liste aktualisieren?")
    Select
    Case $iMsgBoxAnswer = 6 ;Yes
    ;
    Case $iMsgBoxAnswer = 7 ;No
    ;
    EndSelect
    #EndRegion --- CodeWizard generated code End ---
    ;
    ;
    If $iMsgBoxAnswer = 6 Then
    _GetProxyList(19)
    EndIf
    If $iMsgBoxAnswer = 7 Then
    EndIf
    ;
    ;
    _FileReadToArray("found.txt", $a_foundtxt)
    For $i = 1 To $a_foundtxt[0]
    _TextLookup($a_foundtxt[$i])
    Next
    ;Main_End
    ;;

    [/autoit] [autoit][/autoit] [autoit]

    ;Func _TextLookup($Dat)
    ;
    Func _TextLookup($Dat)
    $Matchtxt = FileOpen("Match.txt", 1)
    $aRegExp = StringRegExp(FileRead($Dat), '("(+(\.[a-z]+){1,2}(\&quot;|\/\&quot;|\/[\-a-z0-9]+\/&quot;))'']http://www\.|http://)[\-a-z0-9]+(\.[a-z]+){1,2}(\"|\/\"|\/[\-a-z0-9]+\/"))', 4)
    For $x = 0 To UBound($aRegExp) - 1
    $dummy = $aRegExp[$x]
    FileWriteLine($Matchtxt, StringReplace($dummy[1], '"', ''))
    ConsoleWrite(StringReplace($dummy[1], '"', '') & @CRLF)
    Next
    FileClose($Matchtxt)
    EndFunc ;==>_TextLookup
    ;Func _GetProxyList($pages)
    ;
    Func _GetProxyList($pages)
    $h_foundtxt = FileOpen("found.txt", 2)
    For $i = 1 To $pages
    InetGet("http://www.proxy4free.com/list/webproxy" & $i & ".html", "webproxy" & $i & ".html")
    FileWriteLine($h_foundtxt, "webproxy" & $i & ".html")
    Next
    FileClose($h_foundtxt)
    ;
    $h_foundtxt = FileOpen("found.txt", 1)
    InetGet("http://www.stayinvisible.com/web_proxy_list.html", "webproxy.html")
    FileWriteLine($h_foundtxt, "webproxy.html")
    FileClose($h_foundtxt)
    ;
    $p = 0
    $Page = 200
    $h_foundtxt = FileOpen("found.txt", 1)
    For $o = 1 To $page
    InetGet("http://www.tech-faq.com/proxy.shtml?start=" & $p, "webfaqproxy" & $o & ".html")
    FileWriteLine($h_foundtxt, "webfaqproxy" & $o & ".html")
    $p = $p + 25
    Next
    FileClose($h_foundtxt)
    EndFunc ;==>_GetProxyList
    ;

    [/autoit]

    Meine "_callHP.au3":

    Spoiler anzeigen
    [autoit]


    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;declare
    ;;
    ;$url = "Proxy-Server-Liste"
    Global $targeturl = "www.google.de"
    Global $ProxyFile = "Match.txt"
    Global $ProxyCount = _FileCountLines($ProxyFile)
    Global $aLine
    ;Main
    ;;
    _FileReadToArray($ProxyFile, $aLine)
    For $i = 1 To UBound($aLine) -1
    _callProxyHP($aLine[$i], $targeturl)
    Next
    For $az = 1 to $ProxyCount
    $ProxAct = FileOpen("Match.txt", 1)
    $ProxyAddress = FileReadLine($ProxAct, $az)
    _callProxyHP($ProxyAddress, $targeturl)
    Next
    ;func _callProxyHP($url, $targeturl)
    ;;
    func _callProxyHP($url, $targeturl)
    $IEProxy = _IECreate($url, 0, 1, 1, 1)
    _IEAction ($IEProxy, "focus")
    Send("www.google.de")
    Send("{Enter}")
    _IELoadWait($IEProxy)
    _IEQuit($IEProxy)
    EndFunc
    ;EndFunc _callProxyHP($url, $targeturl)

    [/autoit]


    Mein Problem ist jetzt nur noch das ich auf manchen Proxy-Seiten nix ins Eingabefeld bekomme.

    Hab schon versucht mit _IEFormElementSetValue und _IEFormGetObjByName zu arbeiten..funzte auch nicht so richtig.

    Wenn da noch jemand Rat wüsste!? :whistling:


    Hier iss auch nix inne Ausgabedatei (*mpf*):

    Spoiler anzeigen
    [autoit]


    #include <file.au3>
    #include <array.au3>
    #include <string.au3>
    #include <IE.au3>
    #include <INet.au3>
    ;
    ;;
    $Matchtxt = FileOpen("Match.txt", 1)
    $String = _IECreate("http://proxy.org/cgi_proxies.shtml", 0 ,1 ,1 ,1)
    $aArray = StringRegExp(_INetGetSource($String),'<option value="(.*?)">',1)
    For $x = 0 To UBound($aArray) - 1
    $dummy = $aArray[$x]
    FileWriteLine($Matchtxt, StringReplace($dummy[1], '"', ''))
    ConsoleWrite(StringReplace($dummy[1], '"', '') & @CRLF)
    Next
    FileClose($Matchtxt)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Matchtxt = FileOpen("Match.txt", 1)

    [/autoit]