Aim: a school we work with wants to see photos and text from the last e.g. 4 tweets, to be displayed on a large screen in the entrance foyer. I'd like to do this using Node-RED because it's familiar to me, and I like the options for integrating other info on the display screen at a later date (weather / news snippets etc.)
QUESTION 1 - Has anyone done such a project?
Unfortunately the Twitter node only seems to pick up on tweets that have been published after the nodes are in place, as opposed to being able to periodically poll for the last 4 tweets. I guess this is because it uses the stream API.
QUESTION 2 - is there any way to pick up the most recent x tweets from a search query?
Having played around with this a bit today, I've been able to extract the image URL
.tweet.entities.media.media_url and would obviously be possible to extract multiple images by looking at the array found under "extended_entities), i.e.
Quick view of the work involved:
- twitter node uses streaming API, which means it doesn't search last x tweets, but rather collects tweets as they come in.
- we should therefore consider storing tweets and images in the database, so that if for some reason we become disconnected, or we do redeploy and the stream is lost, we don't have a blank display
- we need to determine whether there is an image, and display different elements onto dash accordingly. i.e. large text if there is no image, smaller text if it accompanies one or more images
- we also need to determine how many images there are and size them smaller, to fit into the same space as a single-image tweet
- we need to determine the size of images and resize them according to their longest size, in order that there are no image truncations with scroll bars within dashboard elements
Let me know if anyone has done something like this!