/// <summary> /// 获取视频地址 /// </summary> /// <param name="URL">直播间地址</param> /// <returns>视频地址集合</returns> public static string[] GetVideoURL(string URL) { string str = Bas.GetBody(URL); Regex reg = new Regex("<script>window.__NEPTUNE_IS_MY_WAIFU__={.*}</script>"); string jsonstr = reg.Match(str).Value; jsonstr = Regex.Split(Regex.Split(jsonstr, "window.__NEPTUNE_IS_MY_WAIFU__=")[1], "</script>")[0]; List <string> Urls = new List <string>(); foreach (Dictionary <string, object> i in (ArrayList)Bas.GetJsonValueByKey(jsonstr, "playUrlRes/data/durl")) { Urls.Add(Bas.GetJsonValueByKey(i, "url").ToString()); } return(Urls.ToArray()); }
/// <summary> /// 查询直播间是否在播 /// </summary> /// <param name="URL">直播间地址</param> /// <returns>是否在播</returns> public static bool IsLiving(string URL) { string str = Bas.GetBody(URL); Regex reg = new Regex("<script>window.__NEPTUNE_IS_MY_WAIFU__={.*}</script>"); string jsonstr = reg.Match(str).Value; jsonstr = Regex.Split(Regex.Split(jsonstr, "window.__NEPTUNE_IS_MY_WAIFU__=")[1], "</script>")[0]; if ((int)Bas.GetJsonValueByKey(jsonstr, "roomInitRes/data/live_status") == 1) { return(true); } else { return(false); } }
/// <summary> /// 获取文件正确的md5 /// </summary> /// <returns>md5</returns> private static string GetMD5() { return(Bas.GetBody("https://leochen98.github.io/AutoLiveRecorder/md5.txt")); }