ATR Posted October 16, 2011 Posted October 16, 2011 (edited) I want recover an area of the web. And if the number of results are on multiple pages, it doesn't work #include <IE.au3> #Include <String.au3> #Include <Array.au3> RechercheInternet("affaires-sanitaires-sociales-services-publics", "75", "paris") Func RechercheInternet($Rubrique_internet, $CodePostal, $Ville_internet) ConsoleWrite("http://www.pagesjaunes.fr/annuaire/" & $Ville_internet & "-" & $CodePostal & "/" & $Rubrique_internet & " - ") $IE = _IECreate("http://www.pagesjaunes.fr/annuaire/" & $Ville_internet & "-" & $CodePostal & "/" & $Rubrique_internet, 0, 1) ; 3e argument : 0 = non visible - 1 = visible If @error Then MsgBox(16, "Erreur", "La page internet n'a pu être créée correctement.") Exit EndIf _IELoadWait($IE) $oInputs_h1 = _IETagNameGetCollection ($IE, "div") For $oInput_h1 In $oInputs_h1 If StringInStr($oInput_h1.classname, "reformulationZone") Then $Remplacement_espaces = StringRegExpReplace($oInput_h1.outerhtml, '[\h]', '') $Nombre_resultats = StringRegExp($Remplacement_espaces, '(?s)</h1>.*?\d*).*?réponse', 1) If @error = 0 Then If $Nombre_resultats[0] <> "#null" Then $Nombre_pages = Ceiling($Nombre_resultats[0] / 15) ConsoleWrite($Nombre_pages & " page(s)" & @TAB & $Nombre_resultats[0] & " résultat(s)" & @CRLF) $n = 2 For $i = 1 To $Nombre_pages If $i > 1 Then _IENavigate($IE, "http://www.pagesjaunes.fr/trouverlesprofessionnels/changerPage.do?numPage=" & $i) Sleep(1000) EndIf $oInputs = _IETagNameGetCollection ($IE, "li") For $oInput In $oInputs If StringInStr($oInput.classname, "visitCard withVisual sc") Then $Remplacement_espaces = StringRegExpReplace($oInput.outerhtml, '[\h]', '') $Nom_societe = StringRegExp($oInput.outerhtml, '(?s)titleMain">\s*.*?">(.*?)</', 1) If @error = 0 Then If $Nom_societe[0] <> "#null" Then ConsoleWrite("Nom de la societe : " & $Nom_societe[0] & @CRLF) EndIf EndIf $n += 1 EndIf Next Next ;~ _IEQuit($IE) EndIf EndIf EndIf Next EndFunc Edited October 16, 2011 by ATR
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