Linux bash/Shell获取CCTV6电影频道节目单

#!/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'

本文来自博客园,作者:晴云孤魂,转载请注明原文链接:https://www.cnblogs.com/cnhack/p/15088344.html

原文地址:https://www.cnblogs.com/cnhack/p/15088344.html