Twitter流API损坏的数据



我试图用LinqToTwitter库跟踪一些关键字。当我查看缓冲区时,数据格式不正确。

例如,数据应该是这样的:

{"created_at":"Thu Jul 31 04:21:25 +0000 2014","id":494699327386693632,"id_str":"494699327386693632" ...... ,"filter_level":"medium","lang":"tr"}

但是数据看起来像:

{"created_at":"Thu Jul 31 04:21:25 +0000 2014","id":494699327386693632,"id_str":"494699327386693632" ...... ,"filter_level":"medium","lang":"tr"} JCAAIMhJz.jpg","media_url_https":"https://pbs.twimg.com/media/Bt18rBJCAAIMhJz.jpg"
像这样的示例代码(与linqtotwitter的默认示例略有不同):
        await
            (from strm in TwitterCtx.Streaming
             where strm.Type == StreamingType.Filter &&
                 strm.Track == Track
             select strm)
            .StartAsync(async strm =>
            {
                if (!String.IsNullOrEmpty(strm.Content))
                    buffer += strm.Content;
                else
                {
                    if (!String.IsNullOrEmpty(buffer))
                    {
                        streamContentList.Add(buffer);
                        buffer = String.Empty;
                        count++;
                    }
                }
                if (count >= QueryBoundary)
                {
                    Task.Factory.StartNew(() => { mongoAnalyzeUpdateQueryMethod(MongoDB, MongoKeyName, (long)count); });
                    count = 0;
                    streamContentList = new List<string>();
                }
                Console.WriteLine(count);
            });

我想我在试图控制内容时破坏了数据顺序。我该怎么解决这个问题呢?

此问题已在最新版本的LINQ to Twitter v3.0.4中修复。[1]

[1] https://linqtotwitter.codeplex.com/discussions/542281

最新更新