This flow searches Twitter for certain hashtags (in this case water and fail), pushes the Tweet to an output and counts the number of Tweets retrieved. After 5 Tweets, it triggers a signal and resets the counter. It's part of a project that will grow, which will interact with an RPi to control a valve to release water on an accumulation of Tweets.
-
-
Save iamkat/c06f772a9bab705656ec to your computer and use it in GitHub Desktop.
Twitter scrape and count triggers signal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"188722c.7e1afdd","type":"function","name":"Process Tweet","func":"// is it possible to set this to a variable that is then\n// counted by the other function and then fed back in\n// iteratively??\n// initialise the counter to 0 if it doesn't exist already\ncontext.count = context.count || 0; \ncontext.count += 1;\n// make it part of the outgoing msg object\nmsg.count = context.count;\nif (msg.count >= 5) {\n msg.pour = true\n context.count = 0\n} else {\n msg.pour = false\n}\nreturn msg;","outputs":"1","x":294,"y":200,"z":"70a58b06.45bd64","wires":[["ad7f9f55.8be2f8"]]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment