Giter Site home page Giter Site logo

Comments (7)

griffobeid avatar griffobeid commented on June 1, 2024 1

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.

tylerbuchea avatar tylerbuchea commented on June 1, 2024

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.

griffobeid avatar griffobeid commented on June 1, 2024

@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.

tylerbuchea avatar tylerbuchea commented on June 1, 2024

You're welcome @griffobeid and thanks for the info. Hopefully I'll have an answer for you EOD today. Cheers!

from twitter-lite.

tylerbuchea avatar tylerbuchea commented on June 1, 2024

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:

  1. get all tweets with a global location range, then filter the text content on my search term.
  2. 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.

tylerbuchea avatar tylerbuchea commented on June 1, 2024

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.

tylerbuchea avatar tylerbuchea commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.