My bat_iplayer script now has a problem.
Vangelis forthnet
northmedia1 at the.forthnet.gr
Thu Jun 18 16:36:02 PDT 2015
On Mon Jun 8 02:28:40 BST 2015, I wrote:
> As have already posted, "Episode 5" is
> the "subtitle", not the full title; the latter, which is
> "CBBC Official Chart Show, Episode 5" can be
> harvested from the JSON playlist file:
> http://www.bbc.co.uk/programmes/b05yl3kr/playlist.json
> that is if one can come up with the code to do that...
Hi...
We haven't heard back from batguano999 on how
he solved his "bat_iplayer script" issue, plus the bat
script itself has been since removed from the pastebin
link given on the first post of this thread...
Since noone came forth on the list with code to harvest
the complete title from the JSON playlist file, I did my
own searching... Since I am practically Linux-blind,
I stumbled upon the command-line JSON processor
called "jq":
http://stedolan.github.io/jq/
Win32 executable for v1.4 is available and after I
figured out how to install it on my existing
MSYS2_MinGW-w64 compiler, I began some tests;
PID used was b05y8l1r (radio show from last Wednesday).
Since "title" is a nested element, the command I ended up was:
$ wget --quiet -O - http://www.bbc.co.uk/programmes/b05y8l1r/playlist.json |
jq '.defaultAvailableVersion.smpConfig.title'
this printed:
"The Official Chart Update, 17/06/2015"
Then you have to polish that further, e.g.
to make it suitable for a WinOS filename you have to
remove double quotes & forward slashes;
I know very little about stream editors, but with
the aid of google I came up with this crude command:
sed -e 's/"//g' -e 's/\// /g'
which turns it into:
The Official Chart Update, 17 06 2015
Obviously, one with the knowhow can issue a command
to remove all Win forbidden characters from the title string
produced by jq - I'm not the one...
So, full command would be:
$ wget --quiet -O - http://www.bbc.co.uk/programmes/b05y8l1r/playlist.json |
jq '.defaultAvailableVersion.smpConfig.title' | sed -e 's/"//g' -e 's/\//
/g'
=> The Official Chart Update, 17 06 2015
Hope this is of interest to someone...
Regards.
More information about the get_iplayer
mailing list