Can a .net app be made to pull twitter posts?
I am wondering if its possible to capture any of the posts made on twitter by any user? I am trying to obtain an unrestricted flow of tweets to use as sample data for statistical analysis.
I want to try to gauge the sentiment of topics such as "thanksgiving" or "global warming"
I was thinking on a high level I would be able to pull all tweets containing a "#thanksgiving" tag and save them to a SQL DB for analysis.
Is this a valid approach of that, or is there a better way? Is there a tool to do this already that will save me the development time?
You can use the Twitter API.
Specifically, this question contains the answer you'll need to get all tweets with a certain hashtag:
Twitter API - Display all tweets with a certain hashtag?
In terms of tools to do it with, TweetSharp is a C# wrapper for the Twitter API. I can't vouch for it though as I've never used it.
Related
I want to know the method of pulling the data from website and parsing it into our own code to present it to the user.
For example: Consider an app in which a user types a movie name and all the poster gets fetched from various websites, like IMDb, etc. Or a user enters a movie name and all the data from IMDb is fetched. I know about certain third party API services for fetching data from IMDb, like omdbapi and imdbapi, but I want to know the method of doing so from any sort of website, not just IMDb.
I am a complete newbie in this context so please guide me through this from the very beginning. I want to do this in a Windows 8 Store app using C# and XAML in Visual Studio.
Simple way is you use the website's RSS feed. You can find the rss feed for any website. All you have to do is pass the parameters as a query string using a web request object. the response stream will them have all the details that you want that can be parsed through in c# and worked upon.
There is no standard way to do it for any website
you must write your algorithm for each of the websites you want to get the content from
HttpClient
is you tool in getting web content in your app
Check out YQL:
The Yahoo Query Language is an expressive SQL-like language that lets you query, filter, and join data across Web.
You should use Html Agility Pack.
For better performance, host your scraping service on Azure.
It's unclear to me how I can do an API request to retrieve data for the YouTube API.
I used this code (http://zavitax.wordpress.com/2012/12/17/logging-in-with-google-service-account-in-c-jwt/) to get an access token. The next step is: https://developers.google.com/youtube/v3/guides/authentication?hl=en#OAuth2_Calling_a_Google_API. I don't know how to use www.googleapis.com/youtube/v3/video?access_token=ACCESS_TOKEN in my application to retrieve data. How can I use my access token to request data from the API?
The recommendation is to use the Google APIs Client Library for .NET. As the webpage for the client library states, it's still undergoing active development and isn't as far along as the client libraries for some of the other languages. It still should be usable, though.
There are specific generated classes to use with the YouTube Analytics API and the YouTube Data API v3. You'll need to download those
Our C# sample code is unfortunately scarce, but there is one example of doing a video search. Hopefully that is enough to get you started.
To do anything with the Analytics API, and any write operations with the Data API, you'll need to be authenticated with OAuth 2. There's an explanation of how to do that in the client library docs.
The client library is maintained by a team within Google, but it's not the YouTube API team, so the best way to follow up with the maintainers with any issues you find is to use the public issue tracker.
I am trying to post a single tweet in my Windows phone application to any twitter account. I don't want to complicate my code using external libs or APIs. If they are unavoidable, I will include. I don't need to read any tweets or need to persist my connection. Its simple, The user supplies a username, password and a tweet message and hits tweet.
The famous temple run in iPhone has exactly what I need (screenshot below).
Please guide me in C#
This is possible via XAuth. The technique is not straight forward though, your request will have to go through the Twitter API team and once they approve they will give the xAuth Access. See this other SOF answer for more details.
If you want to integrate it like in you screenshot I think you need to communicate with the API yourself.
But there is the ShareStatusTask in the Microsoft.Phone.Tasks namespace.
With that users can share your status to the social media they configured.
Also check: http://msdn.microsoft.com/en-us/library/hh394027(v=vs.92).aspx
You have two choices:
use the built-in ShareStatusTask
roll your own system.
The advantage of ShareStatusTask is that it is simple to implement and maintain.
For the user it is also a good solution as it will allow him to post the status on the social network of its choice and it avoids forcing him to authenticate again.
If you want to roll your own system, you'll have to deal with different problems:
user authentication (OAuth)
maintenance (sometimes Twitter like to change the way 3rd party apps
interact with them...)
Here is a tutorial that explains how to implement Twitter in a Windows Phone app.
Also Tweetsharp is a nice Twitter lib you can use
I am developing a Facebook application, where my application will aggregate all the photos of my friends in their albums. How will i achieve using graph api and C#?
First, look at this answer: Can I use the Facebook graph api to get user's friends profiles pictures ?
This will let you know how to generally use the graph api to get the to the friends. If you use albums instead of photo, you should get all the albums of a friend.
To get there, you will also need the friends_photos permission. I don't know if it is still up to date, but maybe you will need some more permissions.
I'm no C# developer, but these links will help you:
C# Facebook Graph API Library
Facebook C# SDK
Facebook API from C# – Getting the list of friends
Facebook recently made a nice tool you can use to explore how to get the details you need. It's called the Graph API Explorer and can be found here: https://developers.facebook.com/tools/explorer
But what is said in the other answer is correct. First you get the list of friends. Then their albums, and then the photos in the albums. Once you get the hang of the Graph API it's quite easy, but it requires a bit of tinkering to figure out at first.
If you are using C# you can use a WebRequest to get the data. Whenever you access http://graph.facebook.com/whateveryouwant it will return a string of JSON-data. This you can parse using a JSON-librabry like litJSON.
I have made an application that gets the profile photos, and it is not that hard. Just remember to get the right permissions.
The easiest way to do this is to use the Javascript API to get the loginstatus and then get some permissions. If you set cookies: true when you init the Facebook API you can get the accesss_token from the cookie. The cookie is named "fbs_YOURAPPID".
Also you need to make a developer app to get an access_token.
It sure is a pain to prune a Facebook profile. Is there any way using the Facebook API (or some other mechanism) to authenticate as a particular user and remove friends from the user's list? I have looked through the API documentation, but I'm not familiar with the ins and outs of the platform.
I have been through the complete facebook graph api documentation on facebook while i was writing my open source .net sdk for facebook. From all that i understand, i am 99.9 % sure that this cannot be done using their api. You can create status messages, links, photos, albums, events, pages, notes etc using their api ( you need to perform simple post operations for all this ), but i have read no where that a friend can be removed using facebook api !
No API but you can program your browser or mimick a browser. Think of QtWebKit. I doubt if you need to add so many friends and just to remove them using machine.