Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

Created Unassigned: How to read the tweet country and the user id [2402]

$
0
0
I tried to get the user name and the country name but it's always giving me null reference error
https://dev.twitter.com/rest/reference/get/trends/place

I tried two ways but both are failed
protected void Page_Load(object sender, EventArgs e)
{
//Verify Twtter Credenital
var credentials = Tweetinvi.TwitterCredentials.CreateCredentials("258681973-8OZad82QWQwftW1LVeCMZWwoZ4UDKcDStcAtuZeo", "sv7C6zMM9VaCvmpuY3jXH8wNmbOZOQSmmawnuwBzolKZ0", "uzIuoawfBPWi83jZ7GBC2hCpj", "uvPRPrIz8PmLSxqC1vNCHCO1KwLLgzSQYLFaQZ9UByNORfdlqq");

//Execute Operation with Creatdential
TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
{
//Generate Map & Markup
runcode("#ACME", true);

});
}

protected void runcode(string parameter, bool advanceSearch)
{
string tweetFeed = "";


var searchParameter = Tweetinvi.Search.GenerateSearchTweetParameter(parameter);
searchParameter.MaximumNumberOfResults =100;

var result = Tweetinvi.Search.SearchTweets(searchParameter);
int i = 0;
foreach (var item in result)
{
try
{
tweetFeed = result.ElementAt(i).Place.IdStr.ToString();
Response.Write(tweetFeed + "<br>");

}
catch (Exception e)
{
//do nothing
}
finally
{
i = ++i;
}

}
}

even i use that one

tweetFeed = item.ToString();

var searchQueryHelper = TweetinviContainer.Resolve<ISearchQueryHelper>();
var tweetDTOs = searchQueryHelper.GetTweetsFromJsonResponse(tweetFeed);
var tweets = Tweet.TweetFactory.GenerateTweetsFromDTO(tweetDTOs);
tweets.ElementAt(0).Place.Country.ToString();

it's also not workable any example for it

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>