本文整理汇总了C#中Lookup.setUserId方法的典型用法代码示例。如果您正苦于以下问题:C# Lookup.setUserId方法的具体用法?C# Lookup.setUserId怎么用?C# Lookup.setUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup.setUserId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getRTImpression
public int getRTImpression(string tweet_id)
{
GetRetweeters getRetweetersChoreo = new GetRetweeters(session);
// Set inputs
getRetweetersChoreo.setAccessToken(accessToken);
getRetweetersChoreo.setID(tweet_id);
getRetweetersChoreo.setAccessTokenSecret(accessTokenSecret);
getRetweetersChoreo.setConsumerSecret(consumer_secret);
getRetweetersChoreo.setConsumerKey(consumer_key);
// get retweeters
Console.WriteLine("Getting retweeters");
GetRetweetersResultSet getRetweetersResults = getRetweetersChoreo.execute();
JObject json_response = JObject.Parse(getRetweetersResults.Response);
JArray ja = (JArray)json_response["ids"];
string s_users = "";
foreach (JToken jt in ja)
{
if (jt != ja.Last)
{
s_users += jt.ToString() + ",";
}
else
{
s_users += jt.ToString();
}
}
Lookup lookupChoreo = new Lookup(session);
// Set inputs
lookupChoreo.setAccessToken(accessToken);
lookupChoreo.setAccessTokenSecret(accessTokenSecret);
lookupChoreo.setConsumerSecret(consumer_secret);
lookupChoreo.setConsumerKey(consumer_key);
lookupChoreo.setIncludeEntities("false");
lookupChoreo.setUserId(s_users);
// get user data
Console.WriteLine("Getting retweeter followers");
LookupResultSet lookupResults = lookupChoreo.execute();
ja = JArray.Parse(lookupResults.Response);
string s_followers = "";
int followers_count = 0;
foreach (JToken jt in ja)
{
s_followers = (string)jt["followers_count"];
followers_count += int.Parse(s_followers);
}
// add up followers
// return followers
return followers_count;
}