public string Miaopai_load(string url) { Console.WriteLine("miao pai start ----- url = " + url); string fid = YouGetCommon.MatchOne(url, @"\?fid=(\d{4}:\w{32})"); if (fid != null && !fid.Equals("")) { return(Miaopai_load_bg_fid(fid)); } else if (url.Contains("/p/230444")) { fid = YouGetCommon.MatchOne(url, @"/p/230444(\w+)"); return(Miaopai_load_bg_fid("1034:" + fid)); } else { string mobile_page = YouGetCommon.Get_content(url, fake_headers_mobile); Regex reg = new Regex(@"""page_url""\s*:\s*""([^""]+)"""); Match m = reg.Match(mobile_page); string videoUrl = YouGetCommon.MatchOne(mobile_page, @"<video.*src=['""](.*?)['""]"); if (m != null && m.Success) {//网页内容里面没有数据 string escaped_url = m.Groups[1].Value; string webUrl = HttpUtility.UrlEncode(escaped_url); return(Miaopai_load(escaped_url)); } else if (videoUrl != null) //网页内容里直接有video信息 { Console.WriteLine("web page content video === "); return(YouGetCommon.Url_info_to_json(videoUrl, null)); } else //尝试header中是否有Location { Dictionary <string, string> mobile_header = YouGetCommon.GetHTTPResponseHeaders(url, fake_headers_mobile); string key = "Location"; if (mobile_header.ContainsKey(key)) { string locationUrl = mobile_header[key]; Console.WriteLine("go other link == " + locationUrl); if (locationUrl != null && !locationUrl.Equals("")) { string locaHost = getExtractUrlHost(locationUrl); if (locaHost != null && !locaHost.Equals("")) //可以转条连接 { return(new YouGetExtractor().YoutGetExtract(locationUrl)); } } } } } return(null); }
private string Get_miaopai_scid(string url) { string scid = null; string[] regs = new string[] { @"miaopai\.com/show/channel/(.+)\.htm", @"miaopai\.com/show/(.+)\.htm", @"m\.miaopai\.com/show/channel/(.+)\.htm", @"m\.miaopai\.com/show/channel/(.+)" }; foreach (string reg in regs) { scid = YouGetCommon.MatchOne(url, reg); if (scid != null && !"".Equals(scid)) { return(scid); } } return(null); }
public string Yixia_miaopai_load_by_scid(string scid) { string api_endpoint = "http://api.miaopai.com/m/v2_channel.json?fillType=259&scid=" + scid + "&vend=miaopai"; string html = YouGetCommon.Get_content(api_endpoint, null); if (html == null) { return(null); } JObject api_content = (JObject)JsonConvert.DeserializeObject(html); string urlTemp = api_content["result"]["stream"]["base"].ToString(); string video_url = YouGetCommon.MatchOne(urlTemp, @"(.+)\?vend"); string title = api_content["result"]["ext"]["t"].ToString(); string resultInfo = YouGetCommon.Url_info_to_json(video_url, null); return(resultInfo); }
public string Krcom_load(string url) { string page = YouGetCommon.Get_content(url, null); if (page != null) { try { //Console.Write(page); //Console.WriteLine("==================="); string videosource = YouGetCommon.MatchOne(page, @"video-sources=\\""fluency=(.*?)\\"""); string decodeVideoSource = HttpUtility.UrlDecode(videosource); Console.WriteLine("Krcom_load ---" + decodeVideoSource); string[] videoUrls = Regex.Split(decodeVideoSource, "//", RegexOptions.IgnoreCase);; JArray jArr = new JArray(); foreach (string v in videoUrls) { if (!YouGetCommon.isEmptyStr(v)) { string videoUrl = "http://" + v; JObject json = new JObject(); json.Add("video_url", videoUrl); if (videoUrl.Contains("map4")) { json.Add("video_type", "mp4"); } jArr.Add(json); } } return(jArr.ToString()); } catch (Exception e) { Console.WriteLine(e.Message); } } return(null); }
public string Miaopai_load_bg_fid(string fid) { string page_url = "http://video.weibo.com/show?fid=" + fid + "&type=mp4"; string mobile_page = YouGetCommon.Get_content(page_url, fake_headers_mobile); if (mobile_page != null) { string p = @"<video id=.*?src=[\'""](.*?)[\'""]\W"; Console.WriteLine(p); string url = YouGetCommon.MatchOne(mobile_page, p); string title = YouGetCommon.MatchOne(mobile_page, @"<title>((.|\n)+?)</title>"); if (title == null || title.Equals("")) { title = fid; } title = title.Replace("\n", "_"); return(YouGetCommon.Url_info_to_json(url, null)); } return(null); }
private string getExtractUrlHost(string url) { return(YouGetCommon.MatchOne(url, @"(https?://[^/]+)/")); }
private string getHostName(string host) { return(YouGetCommon.MatchOne(host, @"//([^.]+)\.")); }