Inheritance: Livet.NotificationObject
示例#1
0
        public IList<NicoNicoFavoriteLiveContent> GetLiveInformation()
        {
            try {

                var a = NicoNicoWrapperMain.Session.GetAsync(LiveUrl).Result;

                var doc = new HtmlDocument();
                doc.LoadHtml2(a);

                var content = doc.DocumentNode.SelectSingleNode("//div[@class='content']");

                if(content == null) {

                    return null;
                }

                var outers = content.SelectNodes("child::div[@id='ch']/div/div[@class='outer']");

                //終了
                if(outers == null) {

                    return null;
                }

                var list = new List<NicoNicoFavoriteLiveContent>();

                foreach(var outer in outers) {

                    var entry = new NicoNicoFavoriteLiveContent();

                    entry.CommunityUrl = outer.SelectSingleNode("child::a[1]").Attributes["href"].Value;

                    var img = outer.SelectSingleNode("child::a/img");

                    entry.ThumbNailUrl = img.Attributes["src"].Value;
                    entry.CommunityName = "<a href=\"" + entry.CommunityUrl + "\">" + img.Attributes["alt"].Value + "</a>";

                    var section = outer.SelectSingleNode("child::div");

                    entry.Title = section.SelectSingleNode("child::h5/a").InnerText.Trim();
                    entry.LiveUrl = section.SelectSingleNode("child::h5/a").Attributes["href"].Value;
                    entry.StartTime = section.SelectSingleNode("child::p[@class='time']/small").InnerText;

                    list.Add(entry);
                }

                return list;
            } catch(RequestTimeout) {

                return null;
            }
        }
示例#2
0
        public IList <NicoNicoFavoriteLiveContent> GetLiveInformation()
        {
            try {
                var a = NicoNicoWrapperMain.Session.GetAsync(LiveUrl).Result;

                var doc = new HtmlDocument();
                doc.LoadHtml2(a);

                var content = doc.DocumentNode.SelectSingleNode("//div[@class='content']");

                if (content == null)
                {
                    return(null);
                }

                var outers = content.SelectNodes("child::div[@id='ch']/div/div[@class='outer']");

                //終了
                if (outers == null)
                {
                    return(null);
                }

                var list = new List <NicoNicoFavoriteLiveContent>();

                foreach (var outer in outers)
                {
                    var entry = new NicoNicoFavoriteLiveContent();

                    entry.CommunityUrl = outer.SelectSingleNode("child::a[1]").Attributes["href"].Value;

                    var img = outer.SelectSingleNode("child::a/img");

                    entry.ThumbNailUrl  = img.Attributes["src"].Value;
                    entry.CommunityName = "<a href=\"" + entry.CommunityUrl + "\">" + img.Attributes["alt"].Value + "</a>";

                    var section = outer.SelectSingleNode("child::div");

                    entry.Title     = section.SelectSingleNode("child::h5/a").InnerText.Trim();
                    entry.LiveUrl   = section.SelectSingleNode("child::h5/a").Attributes["href"].Value;
                    entry.StartTime = section.SelectSingleNode("child::p[@class='time']/small").InnerText;

                    list.Add(entry);
                }

                return(list);
            } catch (RequestTimeout) {
                return(null);
            }
        }
示例#3
0
        public void Open()
        {
            if(SelectedLive != null) {

                NicoNicoOpener.Open(SelectedLive.LiveUrl);
                SelectedLive = null;
            }
        }