Searching tweets with hashtag

May 25, 2014 at 12:33 PM
Hi,
 I am currently using Tweetinvi for a research project for Tweets collection. I want to get tweets based on some hashtag. I have found here a relevent topic https://tweetinvi.codeplex.com/discussions/464055.
But the example given here won't work with current version of Tweetinvi. It won't find IToken class and also won't get ObjectResponseDelegate class. Although, I have included the Tweetinvi.Core.Extensions;

Please give a concrete and complete example. Whether search by Hashtag is available in current version of Tweetinvi or how I can collect?
Coordinator
May 26, 2014 at 8:41 PM
The post is outdated. In tweetinvi it is now possible to do searchs.
Just use the following method.
var resultSet = Search.SearchTweets("#tweetinvi");
Regards,
Linvi
Oct 1, 2014 at 4:48 PM
Dear Linvi,
thank you for the update.
If I do in the home controller of a MVC application (target framewor 4.5.1)

var matchingTweets = Search.SearchTweets("#flood");

it gives me the error below and I cannot understand why. Can you give me an hint? Thank you

Value cannot be null.
Parameter name: source

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: source

Source Error:


Line 17: public ActionResult Index()
Line 18: {
Line 19: var matchingTweets = Search.SearchTweets("#flood");
Line 20: foreach (var matchingTweet in matchingTweets)
Line 21: {

Source File: c:\Users\Claudio\Documents\Visual Studio 2013\Projects\TweetMVC\TweetMVC\Controllers\HomeController.cs Line: 19

Stack Trace:


[ArgumentNullException: Value cannot be null.
Parameter name: source]
System.Linq.Enumerable.ToList(IEnumerable1 source) +5899878
Tweetinvi.Search.SearchTweets(String searchQuery) +114
TweetMVC.Controllers.HomeController.Index() in c:\Users\Claudio\Documents\Visual Studio 2013\Projects\TweetMVC\TweetMVC\Controllers\HomeController.cs:19
lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) +242
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +39
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
System.Web.Mvc.Async.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +19
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288