我一直在尝试获取最新的 1000 条推文。我已经阅读了 LinqToTwitter 上的所有文档。我试着写我自己的:
void GetUserTimeLine(TwitterContext ctx)
{
List<String> tweetList = new List<String>();
String[] breakWords;
ulong maxID = 0000;
ulong sinceID = 3396455589; //oldest tweetID
for (int i = 0; i < 5; i++)
{
if (i == 0)
{
var statusTweets =
from tweet in twitterCtx.Status
where tweet.Type == StatusType.User &&
tweet.Count == 200 &&
tweet.SinceID == sinceID &&
tweet.ScreenName == "nyptweets"
select tweet;
tweetList.Add(statusTweets.ToList().ToString());
breakWords = tweetList[tweetList.Count - 1].Split(' ');
maxID = Convert.ToUInt64(breakWords[5].ToString());
}
else
{
var statusTweets =
from tweet in twitterCtx.Status
where tweet.Type == StatusType.User &&
tweet.Count == 200 &&
tweet.SinceID == sinceID &&
tweet.MaxID == maxID &&
tweet.ScreenName == "nyptweets"
select tweet;
tweetList.Add(statusTweets.ToList().ToString());
breakWords = tweetList[tweetList.Count - 1].Split(' ');
maxID = Convert.ToUInt64(breakWords[5].ToString());
}
}
string dwnloadFilePath = @"C:\temp\Tweet.log";
// CREATE AN EMPTY TEXT FILE
FileStream fs1 = null;
if (!File.Exists(dwnloadFilePath))
{
using (fs1 = File.Create(dwnloadFilePath)) ;
}
// WRITE DATA INTO TEXT FILE
if (File.Exists(dwnloadFilePath))
{
using (StreamWriter sw = new StreamWriter(dwnloadFilePath))
{
File.WriteAllLines(dwnloadFilePath, tweetList);
}
}
}
有人可以帮我吗?问题是当我选择一条推文时它不是一个string
因此当我将它添加到它时List<string>
它不起作用。