Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving the source of a tweet using TwitterVB
#1
Someone asked me on one of my YouTube videos how to retrieve the source of a tweet. Well here is the code. This code is meant to be directly added into the source code found in this tutorial : <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=zd2gYBsCjqI&list=UUVwwElhbjWhU">http://www.youtube.com/watch?v=zd2gYBsC ... wwElhbjWhU</a><!-- m -->

Code:
Dim source As String = ""
If entry.Source.ToString.Contains("<") Then
'Source is link, get rid of link crap
source = entry.Source.ToString.Replace("</a>", "")
Dim int As Integer = source.LastIndexOf(">")
source = source.Remove(0, int + 1)
Else
source = entry.Source.ToString
End If
'Source variable is now ready to use
n.SubItems.Add(source)
In this code, the variable named 'Source' actually contains the information about where a tweet was posted from.

Hope this helps!
My Blog | My Setup | My Videos | Have a wonderful day.
#2
Hello,

I am the person who posted the comment on your youtube video. This was exactly what I needed to figure out. Thanks for helping me out. Looking forward to many more of your great tutorials on Visual Basic. Keep up the great work!
#3
What is the proper way to save the tokens that twitter returns after validating the PIN? I heard you mention something in one of the tutorials about it. I'm pretty new to VB, so any help you can provide would be great.
#4
What you should do is save the tokens in a text file with the name of the username. Then type in the Key and key secret, and split them with something like a /

Then, read the text file, and split the text by a / and there you go, you have your two strings.

Hopefully this was easy to understand, if not, let me know!
My Blog | My Setup | My Videos | Have a wonderful day.
#5
Thanks for the quick reply. I see what you talking about. I'm more of a visual learner, so if you could provide some source code to achieve this, it'd be cool. Thanks again.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Saving and Reading oAuth Tokens with TwitterVB brandonio21 6 22,683 08-14-2011, 09:47 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)