Skip to content

Instantly share code, notes, and snippets.

$Content = (Invoke-WebRequest -Uri "https://covid19.innews.gr").Content
$daily_stats = ($content -match '(?<=daily_stats = )(.*)(?=;)')
$daily_stats = $Matches[0] | Out-File "daily_stats.json"
$weekly_stats = $content -match '(?<=weekly_stats = )(.*)(?=;)'
$weekly_stats = $Matches[0] | Out-File "weekly_stats.json"
$three_days_stats = $content -match '(?<=three_days_stats = )(.*)(?=;)'
$three_days_stats = $Matches[0] | Out-File "three_days_stats.json"
$last_stats = $content -match '(?<=last_stats = )(.*)(?=;)'
$last_stats = $Matches[0] | Out-File "last_stats.json"
$total_stats = $content -match '(?<=total_stats = )(.*)(?=;)'
@cventour
cventour / covid19gr-stats.sh
Last active February 23, 2022 12:43
Extract covid19.gov.gr infections stats (whole history)
#!/bin/sh
curl https://covid19.innews.gr | gunzip > covid.html
cat covid.html | grep daily_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > daily_stats.json
cat covid.html | grep weekly_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > weekly_stats.json
cat covid.html | grep three_days_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > three_days_stats.json
cat covid.html | grep last_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > today_stats.json
cat covid.html | grep total_stats | cut -d "=" -f2 | sed 's/^.//;s/.$//' > total_stats.json
rm covid.html