Stream filter by URL Pattern

Apr 4, 2014 at 5:07 AM
Edited Apr 4, 2014 at 5:09 AM
Hi, i am using Tweetinvi for a project where I have to track the stream of tweets that cointains an URL pattern like:

project.com/Promo?key=34FSJDJS (key is what changes from one tweet to another)

I was trying this way:
stream = Stream.CreateFilteredStream();
stream.AddTrack("project.com/Promo")
stream.MatchingTweetReceived += (sender, args) => { ProccessTweet(args.Tweet); };
stream.StartStreamMatchingAllConditions();
but it does not work correctly.

Does someone know how to do it?

Thanks
Coordinator
Apr 5, 2014 at 12:33 AM
Hi,

What do you mean by it does not work correctly, do you mean that it never works or that it sometimes work?

Linvi
Apr 5, 2014 at 1:02 AM
Sorry, I was trying to say that it never works in that case.
Coordinator
Apr 5, 2014 at 11:15 PM
Hi,

Sorry I don't think what you are trying to achieve is possible without receiving "waste" tweets.
If you go on https://dev.twitter.com/docs/streaming-apis/keyword-matching you can type in the box your tweet and it will give you the track you can use to match your tweet.

The issue is that with a parameter '?key=...' there is no url that you could use.
So I would advise adding multiple keywords 'project', 'com', 'promo', 'key'...

And when you receive the tweet filter them in your program.

Linvi
Marked as answer by linvi on 4/6/2014 at 8:40 AM
Apr 6, 2014 at 5:52 PM
Thanks for the idea!

I am trying to do that way but, now I have a new problem. I could observe that:
stream.StartStreamMatchingAllConditions();
//stream.StartStreamMatchingAnyCondition();
they both produce the same tweets. If I have the keywords: Project, key, com, the method StartStreamMatchingAllConditions returns to my program tweets like "This is my best project" or "the effort is the key of winning". I dont know if this behavior is right, is it?






Thanks
Coordinator
Apr 7, 2014 at 12:12 AM
Hi,

No this is the expected behavior if you want to have multiple keywords you need to add them in a single track separated by space.

Example : "project com promo"

Please note that twitter limits the requests to 60 characters.

Linvi
Apr 7, 2014 at 1:20 AM
It works but no with URL's . I think It has something to do with the fact that Twitter change internally URL's to t.co.