switch to latest TweetInvi 09.11.0

Mar 15, 2016 at 8:31 PM
Bonjour Linvi,
I just started a new app with your latest version. I'm not a hightend developper :(
I just need to lauch a "search" every minutes on a simple query.
I've tryed some codes and my VB.net hang when i try to search tweets.
My twitter codes (consumer, consumer secret, token, token secret) are fine and work well in my previous app, but with an old version of your TweetInvi (09.3.3)
Below 2 tests code :
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Imports System.Reflection
Imports Tweetinvi
Imports Tweetinvi.Core
Imports Tweetinvi.Core.Credentials
Imports Tweetinvi.Core.Enum
Imports Tweetinvi.Core.Extensions
Imports Tweetinvi.Core.Interfaces
Imports Tweetinvi.Core.Interfaces.Controllers
Imports Tweetinvi.Core.Interfaces.DTO
Imports Tweetinvi.Core.Interfaces.Models
Imports Tweetinvi.Core.Interfaces.Streaminvi
Imports Tweetinvi.Core.Parameters
Imports Tweetinvi.Json
Imports SavedSearch = Tweetinvi.SavedSearch
Imports Stream = Tweetinvi.Stream

Public Class Form1
    Public consumer_key As String = "XXX"
    Public consumer_secret As String = "xxxx"
    Public token As String = "xxx-xxxx"
    Public token_secret As String = "xxxxx"

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Test1_GetTweets_Click(sender As Object, e As EventArgs) Handles Test1_GetTweets.Click
        Dim creds = New TwitterCredentials(consumer_key, consumer_secret, token, token_secret)
        ' on Tweets line, below on search, the VB.net hang (in the function)
        Dim Tweets = Auth.ExecuteOperationWithCredentials(creds, Function()
                                                                     Dim SearchParameter = New TweetSearchParameters("#ONPC")
                                                                     SearchParameter.Lang = Language.French
                                                                     SearchParameter.MaximumNumberOfResults = 50
                                                                     SearchParameter.TweetSearchType = TweetSearchType.OriginalTweetsOnly
                                                                     Return Search.SearchTweets(SearchParameter)
                                                                 End Function)
        ' check the return from request
        For Each Tweet In Tweets
            RichTextBox1.AppendText(Tweet.Text & vbCrLf)
        Next
    End Sub

    Private Sub Test2_GetTweets_Click(sender As Object, e As EventArgs) Handles Test2_GetTweets.Click
        ' create the credential/oauth
        Dim creds = New TwitterCredentials(consumer_key, consumer_secret, token, token_secret)

        Dim SearchParameter = New TweetSearchParameters("#ONPC")
        SearchParameter.Lang = Language.French
        SearchParameter.MaximumNumberOfResults = 50
        SearchParameter.TweetSearchType = TweetSearchType.OriginalTweetsOnly
        ' ---- on Tweets line, below on search, the VB.net hang.
        Dim Tweets = Search.SearchTweets(SearchParameter)
        ' check the return from request
        For Each Tweet In Tweets
            RichTextBox1.AppendText(Tweet.Text & vbCrLf)
        Next
    End Sub
End Class
Of course something wrong in my code :(
Could you help me to finaly get tweets
Maybe "TimeLine" or "Streams" are better than search... but search seems more "simple" ;)
Really thank you.

Patrick
Coordinator
Mar 15, 2016 at 11:37 PM
Hello,

First of all please note that Tweetinvi has been migrated on Github. So please remember that the latest documentation/version/issues will be posted there.

Concerning your problem, it is quite hard for me to help you without knowing which error you have. Also I am not familiar with VB. I think I do understand your code but if you are able to share it in C# it would be easier for me to read.

To send me the error, please use the ExceptionHandler as explained in the doc : https://github.com/linvi/tweetinvi/wiki/Exception-Handling.

Cheers,
Linvi