コード例 #1
0
        public List <T_RoomModel> GetWebData()
        {
            string YouKuUrl_Fan = DataURL.YouKuUrl_Fan;
            string webResult    = HttpFunction.Get(YouKuUrl_Fan, Encoding.UTF8, 25600000);
            Regex  webRegex     = new Regex(@"<a.*target=""video"".*?title=.*>(.*?)</a>", RegexOptions.IgnoreCase);

            MatchCollection    douyumc   = webRegex.Matches(webResult);
            List <T_RoomModel> modelList = new List <T_RoomModel>();

            foreach (Match m in douyumc)
            {
                Regex regex = new Regex("<a\\s*?href=\"(?<href>.*)\"\\s*?target=\"(?<target>.*?)\\s*?title=\"(?<title>.*?)\">.*</a>",
                                        RegexOptions.Singleline);
                string href = regex.Match(m.Value).Groups["href"].Value;
                href = href.Substring(0, href.IndexOf(".html")).Replace("http://v.youku.com/v_show/", "http://player.youku.com/embed/").Replace("id_", "");
                string title = regex.Match(m.Value).Groups["title"].Value;

                T_RoomModel t_RoomModel = new T_RoomModel();
                t_RoomModel.PlatType   = (int)PlatTypeEmun.youku;
                t_RoomModel.RoomName   = title;
                t_RoomModel.PlayUrl    = href;
                t_RoomModel.RoomBG     = GetImgUrl(webResult, title);
                t_RoomModel.RoomType   = (int)RoomTypeEmun.fan;
                t_RoomModel.CreateTime = DateTime.Now;
                t_RoomModel.UpateTime  = DateTime.Now;
                t_RoomModel.Status     = 1;
                t_RoomModel.OwnerName  = "优酷";
                t_RoomModel.PlayTime   = "";
                modelList.Add(t_RoomModel);
            }
            return(modelList);
        }
コード例 #2
0
ファイル: RoomLiveHelper.cs プロジェクト: tuolei911/YY.TV
        public List <string> GetDouyuDataLiveUserName()
        {
            string douyuUrl    = "https://www.douyu.com/directory/game/DOTA";
            string douyuresult = HttpFunction.Get(douyuUrl, Encoding.UTF8, 25600000);

            Regex           douyureg      = new Regex(@"(?<=<span class=""dy-name ellipsis fl"">)(.*?)(?=</span>)", RegexOptions.IgnoreCase);
            MatchCollection douyumc       = douyureg.Matches(douyuresult);
            List <string>   douyuUserName = new List <string>();

            foreach (Match m in douyumc)
            {
                douyuUserName.Add(m.Value);
            }
            return(douyuUserName);
        }
コード例 #3
0
ファイル: RoomLiveHelper.cs プロジェクト: tuolei911/YY.TV
        public List <string> GetPandaLiveUserName()
        {
            string pandaUrl = "http://www.panda.tv/cate/war3";
            string result   = HttpFunction.Get(pandaUrl, Encoding.UTF8, 25600000);

            Regex           reg = new Regex(@"(?<=<span class=""video-nickname"">)(.*?)(?=</span>)", RegexOptions.IgnoreCase);//[^(<td>))]
            MatchCollection mc  = reg.Matches(result);

            List <string> pandaUserName = new List <string>();

            foreach (Match m in mc)
            {
                pandaUserName.Add(m.Value);
            }
            return(pandaUserName);
        }
コード例 #4
0
ファイル: RoomLiveHelper.cs プロジェクト: tuolei911/YY.TV
        public List <string> GetHuyaUserName()
        {
            List <string> huyaUserName = new List <string>();

            //string huyaUrl = "http://www.huya.com/cache.php?m=Tag&do=getGameTagLiveByPage&gameId=6&tagId=22&page=1";

            for (int i = 0; i <= 10; i++)
            {
                string huyaUrl = "http://www.huya.com/cache.php?m=Game&do=ajaxGameLiveByPage&gid=6&page=" + i.ToString() + "&pageNum=1";

                string huyaresult = HttpFunction.Get(huyaUrl, Encoding.UTF8, 25600000);

                HuyaJson sModel = JsonSerializer.DeserializeFromString <HuyaJson>(huyaresult);

                if (sModel != null && sModel.data != null && sModel.data.list != null)
                {
                    huyaUserName.AddRange(sModel.data.list.Select(e => e.nick).ToList());
                }
            }
            return(huyaUserName);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: tuolei911/YY.TV
        static void Main(string[] args)
        {
            string pandaUrl = "http://www.panda.tv/cate/war3";
            //string huyaUrl = "http://www.huya.com/g/war3#tag22";
            string huyaUrl = "http://www.huya.com/cache.php?m=Tag&do=getGameTagLiveByPage&gameId=6&tagId=22&page=1";


            string result = HttpFunction.Get(pandaUrl, Encoding.UTF8);


            Regex           reg = new Regex(@"(?<=<span class=""video-nickname"">)(.*?)(?=</span>)", RegexOptions.IgnoreCase);//[^(<td>))]
            MatchCollection mc  = reg.Matches(result);

            List <string> pandaUserName = new List <string>();

            foreach (Match m in mc)
            {
                pandaUserName.Add(m.Value);
            }

            string huyaresult = HttpFunction.Get(huyaUrl, Encoding.UTF8);


            HuyaJson sModel = JsonSerializer.DeserializeFromString <HuyaJson>(huyaresult);


            Regex reghuya = new Regex(@"<i class=""nick"" title=""[\s\S]*?"">", RegexOptions.IgnoreCase);//[^(<td>))]
            // Regex reghuya = new Regex(@"(^|,)\s*isNotLive\s*(,|$)", RegexOptions.IgnoreCase);
            List <string>   huyaUserName = new List <string>();
            MatchCollection huyamc       = reghuya.Matches(huyaresult);

            foreach (Match m in huyamc)
            {
                huyaUserName.Add(m.Value.Replace(@"<i class=""nick"" title=""", "").Replace(@""">", ""));
                //huyaUserName.Add(m.Value);
            }
        }