user166013
user166013

Reputation: 1501

to display tweets on website in asp.net

since Twitter has deprecated there api's and using new version 1.1 , I want to use new api of twitter to display tweets, followers, following on my website. I'm not sure where to start and what to do. Could someone please help me and post some code in c#.net.

Thanks in advance

Upvotes: 1

Views: 2575

Answers (2)

Rajan Mistry
Rajan Mistry

Reputation: 16

  1. Open your Twitter and go to your Twitter settings. Find the widget in your template.

  2. Click on Widgets. In that you will see a Create New button.

  3. Click Create button, you will see the configuration of your Twitter.

  4. Add username and themes as you want to display in your website.

  5. Click on Create Widget. After that, the widget returns some HTML code. Copy and paste that code into your project.

Copy the below code and paste in your notepad file, save it as a .html, and run so that you can see the output.

  
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>  
<body>
 <a class="twitter-timeline" href="https://twitter.com/VibrantGujarat" data-widget-id="661486332787580928"  data-screen-name="VibrantGujarat" width="350" height="400" data-chrome="noborders">
		Tweets by @VibrantGujarat</a>
         <script async defer>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>  

</body>
</html>

Upvotes: 0

user2465083
user2465083

Reputation: 595

I am the developer of an API in C# that allow you to access all these features. It is called Tweetinvi and you can access it on codeplex or via nuget.

Here is some examples for your problem:

// Specify your credentials
TwitterCredentials.SetCredentials("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET", "CONSUMER_KEY", "CONSUMER_SECRET");

// Display tweets
var tweets = Timeline.GetHomeTimeline();

// Get Followers
var user = User.GetLoggedUser();
var followers = user.GetFollowers();

// Get Following/Friends
var followers = user.GetFollowers();

As you are working on a web application I would advise to send this information asynchronously using a Websocket/WCF.

Please let me know if this of any help.

Upvotes: 1

Related Questions