コード例 #1
0
        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);
        }
コード例 #2
0
        public string Yixia_xiaokaxiu_load_by_scid(string scid)
        {
            string api_endpoint = "http://api.xiaokaxiu.com/video/web/get_play_video?scid=" + scid;
            string html         = YouGetCommon.Get_content(api_endpoint, null);

            if (html == null)
            {
                return(null);
            }
            JObject api_content = (JObject)JsonConvert.DeserializeObject(html);
            string  video_url   = api_content["data"]["linkurl"].ToString();
            string  title       = api_content["data"]["title"].ToString();
            string  resultInfo  = YouGetCommon.Url_info_to_json(video_url, null);

            return(resultInfo);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }