Exemple #1
0
        private List <VideoInfo> lowGetVideoList(string url, string orderBy, string timeFrame, bool isFromHtml)
        {
            List <VideoInfo> res;

            fromHtml = isFromHtml;
            if (fromHtml)
            {
                string oldnextUrl = nextPageUrl;
                res = base.Parse(url, GetWebData(url, forceUTF8: true));
                foreach (VideoInfo video in res)
                {
                    Dictionary <string, string> playbackOptions = new Dictionary <string, string>();
                    playbackOptions.Add("lq", video.VideoUrl + "&qv=480");
                    playbackOptions.Add("hq", video.VideoUrl + "&qv=720");
                    video.Other = "PlaybackOptions://\n" + Helpers.CollectionUtils.DictionaryToString(playbackOptions);
                }
                if (nextPageUrl.EndsWith("?vo=0") || nextPageUrl.Equals(oldnextUrl))
                {
                    nextPageUrl       = String.Empty;
                    nextPageAvailable = false;
                }
            }
            else
            {
                nextPageUrl = url;
                url         = url + String.Format("muzuid={0}&l={1}&vd={2}&ob={3}&of={4}&format=xml", apiKey, pageSize, timeFrame, orderBy, pageNr * pageSize);
                string      webData = GetWebData(url, forceUTF8: true);
                XmlDocument doc     = new XmlDocument();
                doc.LoadXml(webData);
                res = new List <VideoInfo>();
                foreach (XmlNode node in doc.SelectNodes("//videos/video"))
                {
                    Dictionary <string, string> playbackOptions = new Dictionary <string, string>();
                    VideoInfo video = new MuzuTVVideoInfo();
                    video.Title       = node.SelectSingleNode("artistname").InnerText + ":" + node.SelectSingleNode("title").InnerText;
                    video.Description = node.SelectSingleNode("description").InnerText;
                    video.Length      = node.Attributes["duration"].Value;
                    video.Airdate     = node.Attributes["releasedate"].Value;
                    if (video.Length == "0")
                    {
                        video.Length = null;
                    }
                    string turl = @"http://player.muzu.tv/player/requestVideo?qv={0}&viewhash=ur4uJCOszp6vEJnIEXLUmxWMo&ai=" + node.Attributes["id"].Value;

                    playbackOptions.Add("lq", String.Format(turl, "480"));
                    playbackOptions.Add("hq", String.Format(turl, "720"));
                    video.VideoUrl = playbackOptions["hq"];

                    XmlNode thumb = node.SelectSingleNode("thumbnails/image[@type='6']");
                    if (thumb != null)
                    {
                        video.Thumb = thumb.SelectSingleNode("url").InnerText;
                    }
                    video.Other = "PlaybackOptions://\n" + Helpers.CollectionUtils.DictionaryToString(playbackOptions);
                    res.Add(video);
                }
                if (res.Count == pageSize)
                {
                    nextPageAvailable = true;
                    pageNr++;
                }
                else
                {
                    nextPageAvailable = false;
                }
            }
            return(res);
        }
        private List<VideoInfo> lowGetVideoList(string url, string orderBy, string timeFrame, bool isFromHtml)
        {
            List<VideoInfo> res;
            fromHtml = isFromHtml;
            if (fromHtml)
            {
                string oldnextUrl = nextPageUrl;
                res = base.Parse(url, GetWebData(url, forceUTF8: true));
                foreach (VideoInfo video in res)
                {
                    Dictionary<string, string> playbackOptions = new Dictionary<string, string>();
                    playbackOptions.Add("lq", video.VideoUrl + "&qv=480");
                    playbackOptions.Add("hq", video.VideoUrl + "&qv=720");
                    video.Other = "PlaybackOptions://\n" + Helpers.CollectionUtils.DictionaryToString(playbackOptions);
                }
                if (nextPageUrl.EndsWith("?vo=0") || nextPageUrl.Equals(oldnextUrl))
                {
                    nextPageUrl = String.Empty;
                    nextPageAvailable = false;
                }
            }
            else
            {
                nextPageUrl = url;
                url = url + String.Format("muzuid={0}&l={1}&vd={2}&ob={3}&of={4}&format=xml", apiKey, pageSize, timeFrame, orderBy, pageNr * pageSize);
                string webData = GetWebData(url, forceUTF8: true);
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(webData);
                res = new List<VideoInfo>();
                foreach (XmlNode node in doc.SelectNodes("//videos/video"))
                {
                    Dictionary<string, string> playbackOptions = new Dictionary<string, string>();
                    VideoInfo video = new MuzuTVVideoInfo();
                    video.Title = node.SelectSingleNode("artistname").InnerText + ":" + node.SelectSingleNode("title").InnerText;
                    video.Description = node.SelectSingleNode("description").InnerText;
                    video.Length = node.Attributes["duration"].Value;
                    video.Airdate = node.Attributes["releasedate"].Value;
                    if (video.Length == "0") video.Length = null;
                    string turl = @"http://player.muzu.tv/player/requestVideo?qv={0}&viewhash=ur4uJCOszp6vEJnIEXLUmxWMo&ai=" + node.Attributes["id"].Value;

                    playbackOptions.Add("lq", String.Format(turl, "480"));
                    playbackOptions.Add("hq", String.Format(turl, "720"));
                    video.VideoUrl = playbackOptions["hq"];

                    XmlNode thumb = node.SelectSingleNode("thumbnails/image[@type='6']");
                    if (thumb != null)
                        video.Thumb = thumb.SelectSingleNode("url").InnerText;
                    video.Other = "PlaybackOptions://\n" + Helpers.CollectionUtils.DictionaryToString(playbackOptions);
                    res.Add(video);
                }
                if (res.Count == pageSize)
                {
                    nextPageAvailable = true;
                    pageNr++;
                }
                else
                {
                    nextPageAvailable = false;
                }
            }
            return res;
        }