Open layinka opened 3 years ago
I know this is a very late response. Though if you managed to find an answer for it, I would be happy to learn what was your solution so that I can help others in the future.
Hi, Never found a solution. I had to implement this in nodejs eventually
if you find a solution,let me know too
So the same api (v2) worked for you in node but never worked with Tweetinvi?
Yes
Hi, where can I find the documentation for streamv2, sample and filtered?
I can only find the filteredstream docs for v1; https://linvi.github.io/tweetinvi/dist/streams-v1.1/filtered-stream.html
_stream = Client.StreamsV2.CreateFilteredStream();
var pars = new StartFilteredStreamV2Parameters();
pars.AddCustomQueryParameter("text", "(happy OR happiness) -birthday -is:retweet");
_stream.TweetReceived += HandleTweet;
_stream.EventReceived += HandleEvent;
await _stream.StartAsync(pars);
TweetStream.Services.TweetListener[0]
{"errors":[{"parameters":{"text":["(happy OR happiness) -birthday -is:retweet"]},"message":"The query parameter [text] is not one of [backfill_minutes,expansions,tweet.fields,media.fields,poll.fields,place.fields,user.fields]"}],"title":"Invalid Request","detail":"One or more parameters to your request was invalid.","type":"https://api.twitter.com/2/problems/invalid-request"}
The twitter api for v2 also looks different; https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/quick-start
It now uses rules
Adding and removing rules
You will be using the [POST /2/tweets/search/stream/rules](https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/post-tweets-search-stream-rules) endpoint when both adding and deleting rules from your stream.
To add one or more rule to your stream, submit an add JSON body with an array that contains the value parameter including the rule, and the optional tag parameter including free-form text that you can use to [identify which returned Tweets match this rule](https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/matching-returned-tweets).
nvm, found it!
thanks for the library.
@weirdyang Can you send a link for the docs, I can't find them and am confused how to use streamV2
@weirdyang Yep, It would be helpful if you could share what you've found so that others who are trying to use this library without extensive documentation on the V2 can use it.
And also, @linvi why there is almost no documentation on your website/github on the V2 filtered streams? Are you planning on adding it ever? (Thanks for all the hard work though, it's greatly appreciated!)
Hi @tomazi776 and @SamuelJames101
I based my code off of this comment: https://github.com/linvi/tweetinvi/issues/1070#issuecomment-704780561
I have uploaded my incomplete but working implementation here: https://github.com/weirdyang/tweet-stream/blob/main/tweet-stream-lib/Configuration/TweetConfiguration.cs
rules in appsettings should be in this format:
"Rule": [
{
"Tag": "cats with images",
"Value": "cat has:images -is:retweet"
}
and app credentials:
"AppCredentials": {
"ConsumerKey": "<Your consumer key>",
"ConsumerSecret": "<Your consumer secret>",
"BearerToken": "<Your bearer token>"
}
I am trying to use the v2 filtered search to monitor an handle, but i am getting "Rate Limit Exceeded" almost immediately the stream starts. Here is my code. What am i doing wrong?