Comments (7)
No problem, @tylerbuchea. Thanks for figuring that out for me. That really is an unfortunate limitation. I'll look into implementing the Account Activity API today if I get a chance. 😀
from twitter-lite.
Would you set me up with all of the parameters your using @griffobeid? I can test some stuff out and get back to you.
from twitter-lite.
@tylerbuchea Here's my parameters.
const streamParams = { track: 'atmosphere,barometer,blizzard,breeze,climate,cloudy,condensation,cumulus,dewpoint,disturbance,downburst,downdraft,drizzle,drought,flash flood,flood,flurry,fog,forecast,freeze,frost,funnel cloud,global warming,greenhouse effect,gust,hail,heat,humid,humidity,hurricane,hydrologic cycle,hydrosphere,ice,lake effect,lightning,meteorologist,meteorology,monsoon,overcast,ozone,permafrost,polar,precipitation,prevailing wind,radar,rain,rainbow,shower,sky,sleet,smog,snow,snowfall,snowflake,snowstorm,storm,temperate,temperature,thermal,thunder,thunderstorm,warning,tstorm,t-storm,tornado,tornado warning,tropical,troposphere,turbulence,updraft,visibility,vortex,warm,weather,whiteout,wind,windchill,wind chill factor', locations: '-124.9257514528,23.6428469943,-66.5614257446,49.1686071266', // Bounding box - United States };
Passing them into the stream like so:
client.stream('statuses/filter', streamParams)
I appreciate the quick response!
from twitter-lite.
You're welcome @griffobeid and thanks for the info. Hopefully I'll have an answer for you EOD today. Cheers!
from twitter-lite.
Sorry it took so long @griffobeid at first I was trying to debug your parameters locally then I realized it might be a Twitter API limitation and it looks like I was right.
Apparently the Twitter API doesn't allow you to filter with locations
AND track
. Both of your filters are working but the Twitter Streaming API can only process them as locations
OR track
and they have no intention of adding the "AND" functionality to the Streaming API as you can read in this official discussion
There are two proposed solutions:
- get all tweets with a global location range, then filter the text content on my search term.
- get all tweets for the term (track), then filter out those with a location.
I realize neither of these are good solutions but it is all we have until we implement the new Account Activity API which sounds like might be capable of what you're trying to do.
from twitter-lite.
I created an open issue #27 so you can subscribe to it if you'd like and keep up with our progress on implementing the new API.
I'm going to close this issue for the time being but if you find any new information regarding this please feel free to ping me and we can reopen it.
Also if you're feeling motivated we'd love a PR for Account Activity API support 😄
from twitter-lite.
To add on to this you can use AND for multiple values on the tracking parameter this doesn't solve your problem of doing track AND location, but I thought I would drop this here because it might be useful for some people.
Example:
// OR (commas)
client.stream("statuses/filter", { track: "#bitcoin,#litecoin,#monero" })
.on("data", data => console.log("data", data.text)) // tweets with any three hashtags
// AND (spaces)
client.stream("statuses/filter", { track: "#bitcoin #litecoin #monero" }))
.on("data", data => console.log("data", data.text)) // only tweets with all three hashtags
A comma-separated list of phrases which will be used to determine what Tweets will be delivered on the stream. A phrase may be one or more terms separated by spaces, and a phrase will match if all of the terms in the phrase are present in the Tweet, regardless of order and ignoring case. By this model, you can think of commas as logical ORs, while spaces are equivalent to logical ANDs (e.g. ‘the twitter’ is the AND twitter, and ‘the,twitter’ is the OR twitter).
https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parameters
Also I just wanted to write this down so I don't forget myself. I should probably add it to the docs.
from twitter-lite.
Related Issues (20)
- URL Card Doesn't Appear
- API v2 documentation
- Rate limit handling could be more explicit
- Cannot like a tweet with v2 HOT 3
- TypeScript does not like `new Twitter({ bearer_token })` HOT 1
- How do i tweet to someone who just followed me?
- twitter-lite client stream method always defaults to api version 1.1 HOT 3
- POST to the Cards endpoint fails HOT 1
- Two ways to access data? HOT 1
- Only allow code to post tweets from the account defined in the "follow" parameter.
- Stops Posting Tweets After a Certain Time HOT 1
- How to post link text / images HOT 3
- OAuth 2 error for POST /2/tweets FIXED HOT 15
- Media from Tweet lookup
- Twitter Bookmarks API Endpoint HOT 1
- Tweet on behalf of other users?
- Does `twitter-lite` report the current status of rate limits, in order to get the count of the API requests remaining in the current time-window? HOT 1
- Upcoming API changes
- ReferenceError: Property 'Buffer' doesn't exist
- Could not authenticate you
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitter-lite.