(转)采集woaitingshu有声小说播放地址
By
admin
at 2018-11-25 • 0人收藏 • 1550人看过
感谢培训群里: 撒旦微笑 提供源码
import console; import web.rest.client; /**解码加密参数**/ var JieMa = function(u){ var tab = string.split(u,'*'); var str = ""; for(k,v in tab){ if(k>1){ str = str ++ string.unhex(string.format("%x",v),"")//接受一个指定的 Unicode 值,然后返回一个字符串 } } return str; } ; /**获取播放列表**/ var get_list = function(book_id){ var http = web.rest.client(); var url = "http://www.woaitingshu.com/mp3/{book_id}.html"; var get_list = http.api(url,"GET"); var tab = string.matches(get_list[book_id](),`title='(.*?)' href='/video/\d+-0-(\d+).html`); return tab; } ; /**获取audio地址**/ var get_audio = function(book_id,list_id){ var url = "http://www.woaitingshu.com/video/{book_id}-0-{list_id}.html"; var http = web.rest.client(); var get_audio = http.api(url,"GET",{str =`FonHen_JieMa\('(.*?)'`}) //获取返回的加密信息 var str = JieMa(get_audio[book_id][list_id]().str); //解密 return string.split(str,'&')[1];//分割解密后的参数 } ; /**获取audio播放地址列表**/ var audio_list= function(book_id){ var tab = {}; for(k,v in (get_list(book_id))){ var list = {}; list.title = v[1]; list.url = get_audio(book_id,v[2]) table.push(tab,list) } return tab; } ; /**解析有声小说信息**/ var audio_info = function(url){ url = string.replace(url,"http[s]?\://","") var path = string.split(url,'/'); var book_id = ""; var list_id = 0; /*根据不同的输入url来分别匹配*/ select(path[2]) { case "mp3" { book_id = string.map(url,`/mp3/(\d+).html`)[1];//book_id } case "video" { book_id = string.matches(url,`/video/(\d+)-0-(\d+).html`)[1][1];//book_id list_id = string.matches(url,`/video/(\d+)-0-(\d+).html`)[1][2];//list_id } else { console.log("错误的地址") return ; } } return book_id,list_id; } ; var url = console.getText( "请输入url:" ); if(url=""){ console.log("未输入,使用默认地址") url = "http://www.woaitingshu.com/mp3/6995.html"; } var book_id,list_id = audio_info(url); //console.dump(get_audio(book_id,list_id))//获取当前播放地址,如果是列表页则是第一集 //console.dump(audio_list(book_id)) //获取当前小说播放列表 //console.dump(audio_list(book_id)[list_id+1+1].url)//获取下一集播放地址(list_id从0开始,当前url为audio()[1]) var list = audio_list(book_id); while( list_id <#list-1) { console.dump(list[list_id+1].title,list[list_id+1].url) list_id = console.askYesNo("按Y键下一集,按N键取消")?list_id+1:#list } console.log("结束") console.pause(true);
登录后方可回帖