#!/bin/bash
#查询CCTV6节目表
<<'COMMENT'
API:
https://api.cntv.cn/epg/epginfo?serviceId=tvcctv&c=cctv6&d=20210707&cb=abccctv5&t=jsonp
https://api.cntv.cn/epg/epginfo?serviceId=tvcctv&c=cctv6&d=20210707&cb=abccctv5&t=jsonp
https://api.cntv.cn/epg/epglist?serviceId=channel&t=jsonp&c=cctv6&cb=tv_box3
FROM:http://blog.hackkey.net/archives/linux-cctv6epg
COMMENT
jsonp="abccctv6"
epgURL="https://api.cntv.cn/epg/epginfo?serviceId=tvcctv&c=cctv6&d=%date%&cb=abccctv6&t=jsonp"
if [ $# -eq 1 ] && [[ "${1,,}" == "n" ]]
then
today=$(date +"%Y%m%d" -d '+1 day')
else
today=$(date +"%Y%m%d")
fi
jsonData=$(curl -sSfL ${epgURL//%date%/$today}|sed -r "s/^${jsonp}(//;s/);?$//")
echo "$jsonData"|jq -r '.cctv6.program[]|.showTime+" "+.t'