Ejemplo n.º 1
0
        private bool Init()
        {
            Match mid = reNewID.Match(Url);

            if (mid.Success)
            {
                NewID = mid.Groups[0].Value;
            }
            else
            {
                return(false);
            }

            BaseCmtUrl = "http://coral.qq.com/article/" + NewID + "/comment?";
            NodeUrl    = "http://coral.qq.com/comment/reply/node?";

            QQParm["reqnum"] = 1;
            string CmtUrl = BaseCmtUrl + HttpHelper.arry2urlencoded(QQParm);

            string htmldata = HttpHelper.GetHtml(CmtUrl, "application/json");

            if (htmldata == null)
            {
                return(false);
            }
            QQJson jc = JsonConvert.DeserializeObject <QQJson>(htmldata);

            this.total   = jc.data.total;
            this.hasnext = jc.data.hasnext;
            return(true);
        }
Ejemplo n.º 2
0
        public List <Common.Cmt> GetNextCmts()
        {
            if (this.hasnext)
            {
                List <Common.Cmt> lcmts = new List <Common.Cmt>();

                string CmtUrl   = BaseCmtUrl + GetParm();
                string htmldata = HttpHelper.GetHtml(CmtUrl, "application/json");
                QQJson jc       = JsonConvert.DeserializeObject <QQJson>(htmldata);

                this.first = jc.data.last;
                var cmts = jc.data.commentid;
                this.hasnext = jc.data.hasnext;

                foreach (var cmt in cmts)
                {
                    if (cmt.parent == "0")
                    {
                        Common.Cmt qcmt = new Common.Cmt();
                        qcmt.name     = cmt.userinfo.nick;
                        qcmt.date     = GetTime(cmt.time.ToString()).ToString();   //这TM是时间戳
                        qcmt.location = cmt.userinfo.region;
                        qcmt.content  = cmt.content;
                        qcmt.up       = cmt.up;

                        lcmts.Add(qcmt);
                        QQCmts.Add(qcmt);
                    }
                }
                return(lcmts);
            }
            return(null);
        }