[Share]Twitter VB[Dll Wrapper]

Posts 1–14 of 14 · Page 1 of 1
[Share]Twitter VB[Dll Wrapper]

Twitter VB

Definition: A "wrapper" is essentially a chunk of code (class, dll, etc.) that you will be able to download, drop into your project, and be pretty much ready to go quickly and efficiently . These "wrappers" will handle all the details of the connections, parameters, and interface for you so that you can focus on just using the object(s).

this is for anyone looking to increase their skills and if your bored, If you feel like developing a Desktop Widget, A App, Or a notification service. This is a Twitter API .net Dll Wrapper. Essentially it allows you to use Twitter API without having to lay down any of the annoying (sometimes time consuming) ground work {which for twitter can be annoying especially now that authorization using OAuth is all that is excepted when creating desktop or web applications}, Simply add the .dll as a reference, and create your application using the API

What You Need.

1. A Twitter API Key
Click Here

2. Visual Basic (or studio if using with C#, Web Developer, etc)

3. The .dll attachment located in this thread

Once you have registered your application and receive your Secret Keys you can begin creating your project.

Among a-lot of other things Twitter VB has

A implementation of OAuth for desktop and web applications. (Which is now the only acceptable way to access twitter from a 3rd party app)
Supports Twitter's new "retweet" and "list" functions.
Can upload photos to TwicPic and TweetPhoto.
Provides access to Url shorteners.
100% .NET code, implemented to be compatible with version 2.0 or higher of the .NET Framework. \
it can be used with any .NET-compliant language (C#, C, Delphi, etc).

Here is a quick tutorial(ish), Quickly made a small project to display how to use it.

After adding the dll as a reference

Code:
Imports TwitterVB2
Imports TwitterAPIException
'TwitterAPIException is used to display the error TwitterAPI is displaying (as opposed to a general error from your application ,

Code:
Try 
'Code
Catch Ex as TwitterAPIException
'display error 
end try
Importing Twittervb2 gives you full access to the wrapper, You may see twitter, but that is outdated and uses normal login features which is no longer accepted.

At this point you will have intellisense to guide you. However that API Requires your "Secrets" to gain access to the Twitter API.

First we need to ask the user permission for this app to use their account

Code:
Public TwLog as New TwitterAPI

'On button click event or form load event 
'This will generate a unigue url for the user to use your registered application
Dim AuthUrl As String = tw.GetAuthorizationLink(ConsumerKey, ConsumerKeySecret)
Note: Both ConsumerKey and ConsumerKeySecret are provided by twitter to your development account, don't share this information with anyone as it is used to identify you as a (twitter app) developer as much as it is to gain access to the API.


Once you have a generated URL (which you never need to know, Unless you have some development issues, then maybe you can create a admin part to the application for debugging where all twitter API generated info is stored , like a database for debugging)

Use the URL either in a 3rd party browser or in a browser in your application (or if your not lazy like me, user some parsing to grab the information and cleanly add it to the application)

Code:
 
Webbrowser1.navigate(AuthUrl)
The user will then be asked to login and authorize the application.

Here are some screenshots of the process

Login from in app webbrowser



Authorization screen



Now we need to verify the pin is correct
"Ask Twitter to confirm"
'Allow the user to enter the pin number.

Code:
Dim Validate As Boolean = TwLog.ValidatePIN(Textbox1.text)
If it is valid then

Code:
If Validate Then 
     Dim OAuthToken as String = tw.OAuth_Token()
     Dim OAuthTokenSecret as String = tw.OAuth_TokenSecret()
End If
OauthToken and OauthTokenSecet is generated by Twitter API , so we will just pass the information without knowing it.

That's pretty much it.

To update status use

Code:
TwLog.AuthenticateWith(ConsumerKey,ConsumerKeySecret,OAuthToken,OAuthTokenSecret) 
TwLog.Update(Textbox2.text)
remember you must hardcode your consumerkey and consumerkeysecret, Oauthtoken and Oauthtokensecret are handled "on the fly" so you can leave them as they are.


'Again you can really just parse the information and make this all automatic, just really to lazy.


Get Tweets from homepage

Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","tokensecret")
For Each tweet As TwitterStatus In twlog.HomeTimeline()
' then pass the information to a listbox or similar
Next
for photos you will need a API for either http://twitpic.com/ or http://plixi.com/

Plus the user is required to login from your app because username and password will be required.

Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
twlog.TweetPhotoUpload("C:\filelocation\Image.jpg", textbox1.text, Username.text, Password.Text", "tweet photo API key")

If you would like to user to be able to read direct messages.

Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
For Each message As TwitterDirectMessage In twlog.DirectMessages
'then pass the data to a listbox or something (message.SenderScreenName & " : " & message.Text)
Send a message to a specific account (direct message a user)

Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","tokensecret")
twlog.SendDirectMessage("Twitter UserName to message", "Your Message")
Read a specific users tweets.

Code:
twlog.AuthenticateWith("consumerkey","consumersecret","oauthtoken","oauthtokensecret")
For Each tweet As TwitterStatus In twlog.UserTimeline("Twitter UserName")
'Pass the information to a listbox or whatever (tweet.User.ScreenName & " : " & tweet.Text)
Hope this helps, Have Fun.

'This wrapper is part of the twittervb project over at codeplex.
____________________________

Virus Scan Of Attached File

VirusTotal - Free Online Virus, Malware and URL Scanner

http://virusscan.jotti.org/en/scanre...2c35fad8934fed
TwitterVB-2.5.zipattachment deleted · 109 downloads before removal
Noob release, didn't expect anything better from you.
Quote Originally Posted by Blubb1337 View Post
Noob release, didn't expect anything better from you.
Trollllllllll, Your waiting for the download noob
*Sigh* Noob, can't you even rename the buttons ? -.-
@Release: Nice one !! /yea
I'm to lazy, I am the one who wrote the whole article on naming components . No offense, think I really have the time (for demonstration) to "label" the buttons (could have changed names, labeling is different Noob )

However, Everyone use it, you know you want to ., Make some uber duper super release and credit it to yourself.
Sure lazy....you simply DON'T KNOW how to rename buttons choob
Quote Originally Posted by Blubb1337 View Post
Sure lazy....you simply DON'T KNOW how to rename buttons choob
Lol, maybe we should write a tutorial for him

@NG: I have no idea on what type of releases to make from it ! Ideas x_x
Quote Originally Posted by Blubb1337 View Post
Sure lazy....you simply DON'T KNOW how to rename buttons choob
Code:
SudoChangeButtonOnFlyByNoobSystem.ChangeNow.OkayNow.Now.!!!
???

or no?

@ Xscape - If I where you I would write a complex full featured Twitter Desktop application with Task bar notifications, Then release it as a free application to brother soft or Cnet with a link to your website (in the application), helps build popularity.

Consumers eat up free applications (especially when they are full featured)

This really goes for anyone.

Plus , As long as your application is registered, then whenever a user posts a tweet form your application, it will add a "Tweet by YourapplicationName" tag under the tweets. As far as advertising goes, it's a great opportunity.



@ Ifrank, You can do this yourself with some manipulation, but why? That was DevComponents.




I don't rename buttons.

Might have a try at this. /
Quote Originally Posted by Lolland View Post
I don't rename buttons.

Might have a try at this. /
You should, It will make a great addition to your other applications over at your site.

Plus, Anyone inteested in this, may be happy to know, that you can find .Net wrappers for a lot of API's Including, Splunk, Yahoo, Sqlite (which EVERYONE should use when working with storage, it is light and acceptable on mobile/portable devices {most}), Mail Chimp, Virtual Earth, OpenGL, Crystal Consulting etc. etc. etc. ,


@ off topic how u make the buttens so good same color???
nice maN i, would never find this out xD
Wow. Did not know there was a Twitter API. Thanks, now I can track a ip from someone who is posting shit!
Almost all major internet based companies have api's now. Just some require more work then others. And some are almost impossible to use.
Posts 1–14 of 14 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us