Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

Commented Unassigned: FilteredStream.AddTrack "OR" operator issue [2616]

$
0
0
I realize that the docs say to add each keyword separately, like so:
```
stream.AddTrack("linvi");
stream.AddTrack("tweetinvi");
```
However, I'd like to add them in one call:
```
stream.AddTrack("linvi,tweetinvi");
```

They both seem to work, with matching tweets received on the stream, and they both produce the same HTTPS request to Twitter (as seen in Fiddler):
```
https://stream.twitter.com/1.1/statuses/filter.json?track=linvi%2Ctweetinvi&stall_warnings=true
```

However, the latter (single-call), comma separated keyword track does not behave as expected. As stated, matching tweets are received on the stream; however, the ```MatchedTweetReceivedEventArgs.MatchingTracks``` is empty.

Further, I found that an associated Action<string> is _not_ called for the latter (single-call), comma separated keyword track.
```
stream.AddTrack("linvi,tweetinvi", tweetMessage => Console.Writeline("This will never be written! :[ "));
```
Comments: ** Comment from web user: LeeC **

Thanks for the info and the suggested workaround. I have no problem with the mechanics of adding a lot of "phrases" as Twitter calls them.

<tangent>There is really only one "track" per stream, right? So, after the first ```AddTrack```, I'm adding _to_ ___the___ track, not adding _a_ track. Then, ```MatchedTweetReceivedEventArgs.MatchingTracks``` (tracks is plural, but there is only one) would actually be ```MatchedTweetReceivedEventArgs.MatchingPhrases```. I'm not trying to "mince words;" I'm just trying to get and keep my Twitter terminology straight, because that facilitates clearer communication.

Per [Twitter](https://dev.twitter.com/streaming/overview/request-parameters#track) _the_ __track__ (singular) is "A comma-separated list of phrases" and a __phrase__ may contain one or many __terms__. It is the _phrase_ that is limited to 60 bytes, not the track. Right?</tangent>

Back to my issue, I am trying to make it more efficient to associate sub-groups of related keywords, since I have to merge them into a single stream.

For example, I want to "track" tweets about three topics: motorcycles, cars, and trucks; but, I want to easily separate the matching tweets, per topic. It would be ideal to have each of the three topics match one of just three "tracks". However, I need to use multiple keywords (phrases) per topic. (Human language is messy.)
1. motorcycle, motorbike, chopper
2. car, automobile, vehicle
3. truck, pickup, 4x4

I'd much rather have just three potential ```MatchingTracks``` to deal with than nine, because my numbers won't be three versus nine. It will be 10 versus 150!

Of course I can work with the existing features. This is not a critical need. I just wanted to explain my scenario. I think the terminology mismatches between the Twitter API and TweenInvi caused me to have unrealistic expectations. I thought multiple tracks inferred multiple streams, which does not make sense.

My planned solution: With each call to ```AddTrack```, I'll leverage the associated ```Action<string>``` to associate a "topic ID" with the phrase.


Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>