Have a json file I am trying to parse from podfox to allow me to rename the downloaded files in a "friendly" way. Here's a snippet of json I am working with:
{
"episodes": [
{
"title": "Hired and Fired by Little Richard and Jimi\u2019s first trip on LSD",
"url": "https://www.podtrac.com/pts/redirect.mp3/chtbl.com/track/5899E/traffic.megaphone.fm/HSW2392375869.mp3",
"downloaded": true,
"listened": false,
"published": 1582203660.0
},
{
"title": "Stolen Cars, Broken Taboos, and the Search for Billy Davis",
"url": "https://www.podtrac.com/pts/redirect.mp3/chtbl.com/track/5899E/traffic.megaphone.fm/HSW5134475908.mp3",
"downloaded": true,
"listened": false,
"published": 1581598860.0
},
]
"shortname": "27 Club",
"title": "27 Club",
"url": "https://feeds.megaphone.fm/HSW5142951139"
}
I am trying to, based on the url get the title and pass that to a variable in bash. I can (for the most part) use grep but I know that jq is a better method, I just cannot figure out the syntax to make jq work.
This works with grep on the command line: grep -B 1 HSW2392375869.mp3 < feed.json | grep "title" | cut -d"\"" -f4 but seems like it is a potentially error prone solution.
When I try: jq -c '.["episodes"].url' the shell just hangs indefinitely. I do not require to use jq here, so any method to allow me to search for the url and return (ultimately) the value for published and title will do just fine.