Пример #1
0
        public override void ParseData(string str)
        {
            try
            {
                var obj         = JObject.Parse(str);
                var data        = obj["data"];
                var latestVideo = obj["data"]["latestVideo"];
                var tags        = obj["data"]["tags"].ToList();
                var videos      = obj["data"]["videos"].ToList();
                var visit       = obj["data"]["visit"];

                base.ListOfACContent = new List <AcContent>();
                var ac = new AcContent();
                ac.Bangumi = new Bangumi();

                //base data
                ac.Bangumi.BangumiId = data["bangumiId"].ToString();
                ac.Cover             = data["cover"].ToString();
                ac.Bangumi.CopyRight = data["copyright"].ToString();
                ac.Description       = data["intro"].ToString();
                ac.Bangumi.Month     = data["month"].ToString();
                ac.Title             = data["title"].ToString();
                ac.Bangumi.Week      = data["week"].ToString();
                ac.Bangumi.PlayWay   = data["playWay"].ToString();
                ac.Bangumi.Year      = data["year"].ToString();

                //latest video
                //todo

                //tags
                //todo

                //videos
                ac.DetailVideos = new List <VideoDetail>();
                foreach (var video in videos)
                {
                    VideoDetail vd = new VideoDetail();
                    vd.BangumiId    = video["bangumiId"].ToString();
                    vd.DanmakuId    = video["danmakuId"].ToString();
                    vd.SourceId     = video["sourceId"].ToString();
                    vd.SourceType   = video["sourceType"].ToString();
                    vd.Title        = video["title"].ToString();
                    vd.VideoId      = video["videoId"].ToString();
                    vd.VisibleLevel = video["visibleLevel"].ToString();
                    //vd.UpdateTime = video["updateTime"].ToString();
                    ac.DetailVideos.Add(vd);
                }


                //visit
                ac.Visit = new ACVisit();
                base.ParseVisit(visit, ac);
                base.ListOfACContent.Add(ac);
            }
            catch (Exception ex)
            {
                ACDEBUG.Print(ex.Message);
            }
        }
Пример #2
0
 public async override Task <bool> ParseVideoData(string str)
 {
     try
     {
         JObject obje = JObject.Parse(str);
         var     data = obje["data"];
         var     vd   = new VideoDetail();
         vd.SourceType = data["source"].ToString();
         vd.SourceId   = data["sourceId"].ToString();
         vd.Title      = data["title"].ToString();
         vd.Time       = data["totalseconds"].ToString();
         return(await GetRealUrl(vd));
     }
     catch (Exception ex)
     {
         ACDEBUG.Print(ex.Message);
         return(false);
     }
     return(true);
 }
Пример #3
0
        private async Task <bool> GetRealUrl(VideoDetail vd)
        {
            try
            {
                var        url  = GetEncodeUrl(vd.SourceId);
                HttpEngine he   = new HttpEngine();
                var        data = await he.Get(url);

                var reader = new StreamReader(data.AsStreamForRead());
                var str    = reader.ReadToEnd();
                var objc   = Newtonsoft.Json.Linq.JObject.Parse(str);
                var keystr = objc["data"].ToString();
                var destr  = Utils.ACAESDecode(keystr, "qwer3as2jin4fdsa");
                GetPlayUrlNotEncode(destr);
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Пример #4
0
        public async override void ParseData(string str)
        {
            try
            {
                JObject obj               = JObject.Parse(str);
                var     data              = obj["data"];
                var     owner             = obj["data"]["owner"];
                JEnumerable <JToken> tags = new JEnumerable <JToken>();
                var videos = obj["data"]["videos"].ToList();
                var visit  = obj["data"]["visit"];

                base.ListOfACContent = new List <AcContent>();
                var ac = new AcContent();

                //root data
                ac.ChannelId   = data["channelId"].ToString();
                ac.ContentId   = data["contentId"].ToString();
                ac.Cover       = data["cover"].ToString();
                ac.Description = data["description"].ToString();
                ac.Display     = data["display"].ToString();
                ac.IsArticle   = data["isArticle"].ToString();
                ac.ReleaseDate = data["releaseDate"].ToString();
                ac.Title       = data["title"].ToString();
                ac.Toplevel    = data["topLevel"].ToString();
                ac.UpdatedAt   = data["updatedAt"].ToString();

                //owner data
                ac.User = new ACUser();
                base.ParseOwner(owner, ac);

                //tags data
                ac.Tags = new List <string>();
                foreach (var tag in tags)
                {
                    ac.Tags.Add(tag.ToString());
                }
                //video data
                ac.DetailVideos = new List <VideoDetail>();
                foreach (var video in videos)
                {
                    var v = new VideoDetail();
                    v.CommentId  = video["commentId"].ToString();
                    v.DanmakuId  = video["danmakuId"].ToString();
                    v.SourceId   = video["sourceId"].ToString();
                    v.SourceType = video["sourceType"].ToString();
                    v.StartTime  = video["startTime"].ToString();
                    v.Time       = video["time"].ToString();
                    v.Title      = video["title"].ToString();
                    v.Url        = video["url"].ToString();
                    v.VideoId    = video["videoId"].ToString();
                    // v.VisibleLevel = video["visibleLevel"].ToString();
                    ac.DetailVideos.Add(v);
                }

                //visit data
                ac.Visit = new ACVisit();
                base.ParseVisit(visit, ac);
                base.ListOfACContent.Add(ac);
            }
            catch (Exception ex)
            {
                ACDEBUG.Print(ex.Message);
            }
        }