Close
Asset

Twitter Filtered Stream (API v2)

Hi, sorry for my english :)

I am a beginner with TouchDesigner and Python is not my language, but following the "Getting Tweets into TouchDesigner For Intermediate" tutorial (thanks @snaut), I tried to do the same thing but with the new Twitter API v2

If you haven't already seen it, I recommend that you first look at the @snaut tutorial, where it explains how to create a developer account for Twitter and gives some tips that you will find in this tox

Unlike @snaut tox, this one uses the filtered stream endpoint group to filter the real-time stream of public Tweets

To use this tox, you will need:

  • a standard developer account for Twitter API v2
  • an OAuth 2.0 Bearer Token for Twitter (generated from the Twitter App dashboard)

 

Once you have entered the tox in your network, you will need to enter the Bearer Token in the "Authentication" page of baseComp "twitterFilteredStream"

The first time you use the tox, you will have to trigger the "Update Rules Pulse" on the "Rules" page for set the initial rules on which to filter the tweets (now there are some default rules that will be of little interest to you, but later you can change them at will)

After setting the token and setting the first rules, you can trigger the "Start Stream Pulse" on "Twitter Filtered Stream" page

If you connect a nullDAT to the baseComp output you should see the tweet stream, where the last column gives information about the rule that filtered it.
Now, without having to stop the stream, you can modify the rules to suit your needs (remember to trigger "Update Rules Pulse" after setting the new rules)

On this page, you can find information regarding how to build custom rules for filtered stream

I hope it will come in handy

P.S. this is my first tox and if you have any suggestions on how I could have done it better or how it could be improved I would love to know

References to the endpoints used are given below:

 

Asset Downloads

Comments