08-04-2011, 09:35 PM
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 -->
In this code, the variable named 'Source' actually contains the information about where a tweet was posted from.
Hope this helps!
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)
Hope this helps!