Parse Twitter JSON data not working?

Hey, everyone! I’ve been following this amazing tutorial: Getting Twitter messages into TouchDesigner - YouTube

The thing is that at the moment of trying to parse the data incoming from Twitter, it doesn’t work (it doesn’t parse anything, it returns me the whole dictionary), no matter how exactly close I get to the example in the tutorial.

I’ll paste the “TwitterFeedExt” DAT to see if anyone can find the mistake:

from TDStoreTools import StorageManager
import TDFunctions as TDF
import json

class TwitterFeedExt:
	"""
	TwitterFeedExt description
	"""
	def __init__(self, ownerComp):
		# The component to which this extension is attached
		self.ownerComp = ownerComp

	def ParseTweet (self, data):
	    # This will parse the json data incoming from the tweets
	    for data in data.splitlines():
	       jsonDict = json.loads(data)
	       
	       # Parse this tweet for text, hashtags and userinfo
	       dataDict = {}
	       dataDict['id'] = jsonDict.get('id', None)
	       dataDict['text'] = jsonDict.get('text', None)

	       debug(dataDict) 
	    return

Hey @uisato,

I wonder if there is a slight misunderstanding - the webClient DAT will always show the complete json coming from twitter - it’s what is in dataDict that is the parsed message.
Further in the tutorial, the parsed data is pushed into a Fifo DAT where only the fields specified in the function are put into columns.

You can crosscheck your work with the tox available on github here:

If I’m wrong with my assumption, could you paste the content of the textport here as well?

Best
Markus

Hey, Markus! So glad to read from you.

I’m pretty sure that when you parse the JSON data in the extension, it automatically parses the whole thing IN the WebClient (around minute: 40:31). Or at least that’s what I understood.

I’ll leave you with said project file (but without the Oauth codes): TwitterApi 001.7.toe (5.1 KB)

EDIT: Just took a look at your project in Github and it works like a charm. I don’t know what I was doing wrong! Thanks, Markus!