Пример #1
0
        public List <MovieItem> GetMovie()
        {
            //http://www.tudou.com/s3portal/service/pianku/data.action?pageSize=90&app=mainsitepc&deviceType=1&tags=77&tagType=3&firstTagId=5&areaCode=530100&initials=&hotSingerId=&pageNo=###&sortDesc=pubTime

            //var ssss = System.IO.File.ReadAllText("json.txt");
            //var ddd = Json.JsonParser.Deserialize(ssss);

            List <MovieItem> listMovieItem = new List <MovieItem>();
            var jsonString = (this.wc as MyWebClient).GetHTML(new Uri(this._currentPage));

            var jsonInstance = JsonParser.Deserialize(jsonString);

            CurrentTypeCount = (int)(jsonInstance.total);
            //Console.WriteLine(jsonInstance.total);
            //Console.WriteLine(ddd.items);
            //Console.WriteLine(ddd.items[0].item[1].Value);

            for (int i = 0; i < jsonInstance.items.Count; i++)
            {
                MovieItem mi = new MovieItem();

                mi.Title = jsonInstance.items[i]["title"]; //电影名称

                mi.DetailURL = jsonInstance.items[i]["playUrl"];

                mi.Tag = jsonInstance.items[i]["playtimes"];
                try
                {
                    mi.UpdateInfo = jsonInstance.items[i]["updateInfo"];
                }
                catch (Exception)
                {
                    mi.UpdateInfo = "";
                }

                //mi.MainActor = jsonInstance.items[i]["actors"];//可能为列表

                for (int j = 0; j < jsonInstance.items[i]["actors"].Count; j++)
                {
                    mi.MainActor += " " + jsonInstance.items[i]["actors"][j]["name"];
                }

                mi.CoverFile = jsonInstance.items[i]["picUrl_448x672"];
                listMovieItem.Add(mi);
            }


            //Console.WriteLine((new System.Collections.Generic.KeyValuePair<string, object>(ddd.items[1]).Items[0].Value));
            return(listMovieItem);
        }