Last active
March 15, 2022 17:00
-
-
Save ynaoto/af9ec30b87119e1bdd76b2b09bdf8040 to your computer and use it in GitHub Desktop.
午後ローDBの全タイトルを放送日付きで取得する
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/sh | |
API_URL="https://gogoro.api.141-lab.com/api/search" | |
yearFrom=1996 | |
yearTo=$(date "+%Y") | |
awk -v y0=$yearFrom -v y1=$yearTo ' | |
BEGIN { | |
for (y = y0; y <= y1; y++) { | |
printf("%4d\n", y); | |
} | |
} | |
' |while read year | |
do | |
from="${year}0101" | |
to="${year}1231" | |
curl -k -s "$API_URL?dateFrom=$from&dateTo=$to" | | |
json_pp |awk -F: ' | |
BEGIN { date = ""; } | |
/broadcast_date/ { date = $2; } | |
/movie_title/ { title = $2; } | |
/special_title/ { special = $2; } | |
/}/ && date != "" { | |
printf("%s%s%s\n", date, title, special); | |
date = ""; | |
} | |
' | | |
sed -e 's/ "//g' -e 's/",/,/g' -e 's/"$//' | | |
sed -e 's/\\"/”/g' | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment