1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$url = "http://recetasdecocina.elmundo.es/tabla-calorias" $result = Invoke-WebRequest $url $objetoresult = $result.AllElements | Where tagName -eq "TR" | %{$_.outerHTML -replace "<td width=193>","|"} $objetoresultgrid = ($objetoresult -replace "<.*?>" -replace "`n","").trim() | %{($_)} $objetoresultgrid | %{($_.split("|").trim())[0]} $mostrar = foreach ($item in $objetoresultgrid) { if($item -notmatch "CALORÍAS") { $item | select @{l='Producto';e={$_.split("|").trim()[0]}},@{l='Calorías';e={[Int]$_.split("|").trim()[1]}} } } $mostrar | Out-GridView</td> |