1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| cls
$wc = new-object System.Net.WebClient
$Country_Array = @("Tunisia","Algeria","Morocco","Libya","Egypt",
"France","Brazil","India","Italy","Spain","Colombia","Argentina",
"Nepal","Iran","Turkey","Germany","Russia","united-arab-emirates","us","Syria")
foreach($Country in $Country_Array) {
$WorldMeter_URL = "https://www.worldometers.info/coronavirus/country/$Country/"
Try {
$Data = $wc.DownloadString($WorldMeter_URL)
$firstString = "<title>"
$secondString = "</title>"
$pattern = "$firstString(.*?)$secondString"
$result = [regex]::Match($Data,$pattern).Groups[1].Value
$1=$result.Replace("Cases","Cas")
$2=$1.Replace("Deaths","Morts")
$3=$2.Replace("and","et")
$result=$3.Replace(" - Worldometer","")
$result
}
Catch
{
Write-Host "`r`n$Country" -ForegroundColor Yellow -BackgroundColor Black
Write-Host "Message: [$($_.Exception.Message)]`r`n" -ForegroundColor Red -BackgroundColor Black
}
} |
Partager