Created
July 1, 2026 06:24
-
-
Save matsubo/0bdca31ae91543fa7548cbda2c7d6a04 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # 銀行名・支店名 結合CSV出力 | |
| echo "bank_code,bank_name,branch_code,branch_name" > banks_branches.csv | |
| curl -s "https://bank.teraren.com/banks.json?per=5000" \ | |
| | jq -r '.[] | [.code, .name] | @tsv' \ | |
| | while IFS=$'\t' read -r bank_code bank_name; do | |
| curl -s "https://bank.teraren.com/banks/${bank_code}/branches.json?per=5000" \ | |
| | jq -r --arg bc "$bank_code" --arg bn "$bank_name" \ | |
| '.[] | [$bc, $bn, .code, .name] | @csv' \ | |
| >> banks_branches.csv | |
| sleep 0.25 # 300req/min/IP のレート制限対策(1リクエストあたり200ms以上) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment