获取广电高清直播源
应用场景比较鸡肋:需要在广电网络环境下(播放视频貌似只能在广电内网,实时图片内外网则都可以显示)。
用自己笨拙的LUA写了个脚本:
local file = io.open("request.xml", "r")
local request_body = file:read("*a")
file:close()
local http=require("socket.http");
local response_body = {}
local res, code, response_headers, status= http.request{
url = "http://portal.rifestone.com:9090/PortalServer-App/services/PortalServer4Client",
method = "POST",
headers =
{
["Content-Type"] = "text/xml; charset=utf-8";
["Connection"] = "keep-alive";
["SOAPAction"] = "http://webservice.tvstore.sumavision.com/doRequest";
["Accept"] = "*/*";
["User-Agent"] = "wsdl2objc";
["Content-Length"] = #request_body;
["Accept-Language"] = "zh-cn";
["Accept-Encoding"] = "gzip, deflate";
},
source = ltn12.source.string(request_body),
sink = ltn12.sink.table(response_body),
}
--print(res)
--print(code)
--print(status)
--[[
if type(response_headers) == "table" then
for k, v in pairs(response_headers) do
print(k, v)
end
end
]]
--print("Response body:")
--[[
if type(response_body) == "table" then
print(table.concat(response_body))
else
print("Not a table:", type(response_body))
end
]]
local data = table.concat(response_body)
local json = string.gsub(data, """, "\"")
print(string.sub(json, 168, string.len(json) - 62))
post数据:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:PortalServer4ClientImplServiceSvc="http://webservice.tvstore.sumavision.com/" xsl:version="1.0">
<soap:Body>
<PortalServer4ClientImplServiceSvc:doRequest>
<arg0>{
"locationName" : "",
"version" : "030101",
"parameters" : {
"programName" : "",
"sortType" : "2",
"end" : "1000",
"channelName" : "",
"channelType" : "0",
"start" : "0"
},
"serialNumber" : "",
"type" : "3",
"location" : "3",
"serverAddress" : "http:\/\/portal.rifestone.com:9090\/PortalServer-App\/services\/PortalServer4Client",
"token" : "dbVtbY5dhzwLS3VBRK2zTQ==",
"sessionId" : "",
"ssid" : "",
"useWifi" : "true",
"user" : "",
"method" : "getChannelInfoListCoke"
}</arg0>
</PortalServer4ClientImplServiceSvc:doRequest>
</soap:Body>
</soap:Envelope>
返回(JSON):
{
"method": "getChannelInfoListCoke",
"status": "0",
"errorMessage": "",
"data": {
"channelInfos": [{
"programNumber": "1",
"charges": "0",
"channelName": "CCTV-1综合高清",
"channelType": [8,
22],
"modulation": "64QAM",
"channelUrl": [{
"d21b138fa38a4fbcb2586a4997ad90bf": "http://10.255.134.15:8060/live/10001_800.m3u8"
},
{
"ed2139d0876f4fe98a4c40606bc65b04": "http://10.255.134.15:8060/live/10001_1200.m3u8"
},
{
"9926c64bda4c4e169dcf6caacf3a04bc": "http://10.255.134.15:8060/live/10001_2000.m3u8"
}],
"imageUrl": [{
"2f3e6f294ba24ecb9273112fe85b513e": "http://10.255.134.8:8082/channelPoster/1_300x200_1449299829541.png?updateTime=20160603171043"
}],
"networkID": "0",
"hdFlag": "0",
"channelID": "22",
"freq": "159",
"timeshiftUrl": [],
"audioPID": "101",
"chaID": "[email protected][email protected]",
"channelDes": "",
"otherInfo": "",
"symbolRate": "6875",
"videoPID": "201",
"rank": "5.5625",
"tsID": "0",
"serviceID": 1,
"liveRealImg": "http://10.255.134.8:8082/channelSefPic/22.jpg",
"onetID": "0"
},
{
"programNumber": "2",
"charges": "0",
"channelName": "CCTV-2经济高清",
"channelType": [8,
22],
"modulation": "64QAM",
"channelUrl": [{
"d21b138fa38a4fbcb2586a4997ad90bf": "http://10.255.134.15:8060/live/10002_800.m3u8"
},
{
"ed2139d0876f4fe98a4c40606bc65b04": "http://10.255.134.15:8060/live/10002_1200.m3u8"
},
{
"9926c64bda4c4e169dcf6caacf3a04bc": "http://10.255.134.15:8060/live/10002_2000.m3u8"
}],
"imageUrl": [{
"2f3e6f294ba24ecb9273112fe85b513e": "http://10.255.134.8:8082/channelPoster/2_300x200_1449299815051.png?updateTime=20160603171043"
}],
"networkID": "0",
"hdFlag": "0",
"channelID": "24",
"freq": "159",
"timeshiftUrl": [],
"audioPID": "102",
"chaID": "[email protected][email protected]",
"channelDes": "",
"otherInfo": "",
"symbolRate": "6875",
"videoPID": "202",
"rank": "5.823529411764706",
"tsID": "0",
"serviceID": 2,
"liveRealImg": "http://10.255.134.8:8082/channelSefPic/24.jpg",
"onetID": "0"
},
10.255.134.8对应外网地址为:pic.rifestone.com (222.206.159.138)
所以
http://10.255.134.8:8082/channelSefPic/22.jpg
对应于:http://pic.rifestone.com:8082/channelSefPic/22.jpg
10.255.134.15服务器用于播放视频,外网地址目前没找到。
内网则可以播放: