返回的数据不规范，需要一些替换，正则不会写-_-#

在 2013年8月13日星期二，Jackson Tian 写道：

> In lib/wechat_push.js:
>
> > +    }
> > +    var fetchUrl = 'http://admin.wechat.com/cgi-bin/getmessage?t=wxm-message&token=' + that.token + '&lang=en_US&count=50';
> > +    var headers = that.headers;
> > +    delete headers['X-Requested-With'];
> > +    delete headers.Connection;
> > +    delete headers['Content-Length'];
> > +    headers.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
> > +
> > +    that.fetchWorkerId = setInterval(function () {
> > +      urllib.request(fetchUrl, {headers: headers, timeout: 10000, type: 'GET'}, function (err, data, res) {
> > +        var message;
> > +        if (err) {
> > +          that.emit('error', err);
> > +        } else {
> > +          var jsonStr = cheerio.load(data.toString())('#json-msgList').html();
> > +          var fetched = jsonlib.parse(jsonStr);
>
> 用json3的理由是什么？
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/node-webot/wechat_push/pull/3/files#r5734129>
> .
>


-- 
发自移动版 Gmail