Code : Tout sélectionner
; http://www.journal-officiel.gouv.fr/association/index.php?ctx=eJyLz2FIK2KIL8tjSCwuzk9miC9kSMwsKs5PK1FIzi8qyC9KLEnVLylKTbVSCskvUGKIz8gscSvNyWEwMmUAAG3jE!U_&page=1&WHAT=airsoft"
#Include <Array.au3>
Global $total = 0, $array[1][5]
$array[0][0] = "Annonce N°"
$array[0][1] = "Date"
$array[0][2] = "Association"
$array[0][3] = "Code postal"
$array[0][4] = "Adresse"
$begin = TimerInit()
$url0 = "http://www.journal-officiel.gouv.fr/association/index.php?ctx=eJyLz2FIK2KIL8tjSCwuzk9miC9kSMwsKs5PK1FIzi8qyC9KLEnVLylKTbVSCskvUGKIz8gscSvNyWEwMmUAAG3jE!U_&page=1&WHAT=airsoft"
$txt0 = BinaryToString(InetRead($url0), 4)
$txt1 = StringRegExp($txt0, '(?s)/\s*(\d{1,3})\s*<', 1)
$nbpages = $txt1[0]
For $page = 1 to $nbpages
$url = "http://www.journal-officiel.gouv.fr/association/index.php?ctx=eJyLz2FIK2KIL8tjSCwuzk9miC9kSMwsKs5PK1FIzi8qyC9KLEnVLylKTbVSCskvUGKIz8gscSvNyWEwMmUAAG3jE!U_&page=" & $page & "&WHAT=airsoft"
$txt = BinaryToString(InetRead($url), 4)
$items = StringRegExp($txt, '(?s)<hr/>(.*?)"hr">', 3)
$n = UBound($items)
ReDim $array[$total+$n+1][5]
For $i = 0 To UBound($items) - 1
$items[$i] = StringReplace($items[$i], " ", " ")
$annonce = StringRegExpReplace($items[$i], '(?s).+?(\d+).+', "$1")
$date = StringRegExpReplace($items[$i], '(?s).+Paru le : <b>(.*?)<.+', "$1")
$assoc = StringRegExpReplace($items[$i], '(?s).+Association : <b>(.*?)<.+', "$1")
$siege = StringRegExpReplace($items[$i], '(?s).+(?:nouvelle adresse|ge social).+?/i>(.*?)(?<!\w\s)<i.+', "$1")
$siege = StringReplace($siege, "è", "è")
$siege = StringReplace($siege, "é", "é")
$siege = StringReplace($siege, "’", "'")
$siege = StringReplace($siege, "â", "â") ; etc
$siege = StringReplace($siege, "ê", "ê") ; etc
$siege = StringReplace($siege, "ç", "ç") ; etc
$siege = StringReplace($siege, "<sup>o</sup>", "°") ; etc
$siege = StringReplace($siege, "<sup>e</sup>", "e") ; etc
$siege = StringReplace($siege, "<sup>r</sup>", "r") ; etc
$siege = StringRegExpReplace($siege, "<i>|</i>", "") ; etc
$codepostal = StringRegExpReplace($siege, '.*(\d{5}).+', "$1")
$array[$total+$i+1][0] = $annonce
$array[$total+$i+1][1] = $date
$array[$total+$i+1][2] = $assoc
$array[$total+$i+1][3] = $codepostal
$array[$total+$i+1][4] = $siege
Next
$total += $n
Next
$diff = Round(TimerDiff($begin)/1000)
$sec = Mod($diff, 60)
$min = Mod($diff/60, 60)
msgbox(0,"", StringFormat("%02i mn %02i sec", $min, $sec))
_ArrayDisplay($array)