Created
April 17, 2019 11:45
-
-
Save teesid/414bf419d99ab63ec19691a2238c1f62 to your computer and use it in GitHub Desktop.
A simple script to pull Dtac Go Inter's roaming parters from their website in to CSV. This works as of 2019-04-17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Zone,Country,Network,Code,399?,899?" | |
# Take note of the -Mj + -Mr jq trick. Extremely useful! | |
curl -G -s 'http://dtac.co.th/gointer-2019/rates.php?lang=EN' \ | |
| jq -Mr '.country | |
| (.Asia | map(["Asia", .])) | |
+ (.Oceania | map(["Oceania", .])) | |
+ (.America | map(["America", .])) | |
+ (.Europe | map(["Europe", .])) | |
+ (.Africa | map(["Africa", .])) | |
| map("curl -G -s \"http://dtac.co.th/gointer-2019/rates.php?lang=EN\" --data-urlencode c=\"\(.[1])\" \\ | |
| jq -Mj \".val | [ \\\"\(.[0])\\\", .Name, .Network, .Code ] | |
| @csv\"; | |
echo -n , | |
curl -G -s \"http://dtac.co.th/gointer-2019/package.php?lang=EN\" --data-urlencode c=\"\(.[1])\" \\ | |
| jq -Mr \".val | [.S399, .S899] | |
| @csv\" | |
") | |
| .[]' \ | |
| /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment