Created
June 15, 2014 18:37
-
-
Save tbelaire/d00cb77fb0db7b38bed2 to your computer and use it in GitHub Desktop.
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 | |
cat all.json | | |
# curl 'http://www.khanacademy.org/api/v1/videos/localized/all' | | |
jq -r ' | |
[ | |
.[] | | |
{ | |
title, | |
en_id:.youtube_ids["en"], | |
errors: | |
(.youtube_ids | |
| with_entries( | |
select (.value | contains("=")) | |
) // {} | |
) | |
} | |
| select( .errors | length > 0 ) | |
| { | |
title, en_id, errors, error_lang: (.errors | keys[]) | |
} | |
| { title, en_id, error_lang, error_id : .errors[.error_lang]} | |
] | sort_by(.error_lang)[] # Note the tailing[], we want values, not an array | |
# Turn into an array and serialize to csv | |
| [ .title, .en_id, .error_lang, .error_id ] | @csv | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment