(转)rest客户端一例,提取网页视频链接
By
admin
at 2020-11-15 • 0人收藏 • 1173人看过
感谢: Xauto 分享源码, rest还没玩过, 收藏以后研究用,^_^
// ${name: getUrl} // ${title: 获取播放地址} import console; import web.json; import web.rest.client _url1 = "https://wx.vzan.com/live/tvchat-405180913?jumpitd=1" _url2 = "https://wx.vzan.com/live/tvchat-808243?shareuid=0&v=1605360819240#" var http = web.rest.client(); var getUrl = function(url){ return http.api(url ,"GET" ,function(ret){ var hlsUrl = string.match( ret, "hlsUrl\s=\s\'(.+?)\'" ); var t = string.split(hlsUrl,'/') if(t[3] == "i3.vzan.cc"){ var json = web.json.parse( string.match(ret, "RedBag\:\s(\{.+?\})") ) return string.format( "https://i3.vzan.cc/clip/%s/%s/%s" ,json.liveId ,json.topicId ,t[#t] ) } else return hlsUrl; })() } console.log( getUrl(_url1) ) console.log( getUrl(_url2) ) console.pause(true); // https://suiang.cn/aardio/code/getUrl.html
登录后方可回帖