OK, here is the situation. I have a relative getting married this coming Saturday, however due to the Covid-19 pandemic and the recent Ontario legislation now banning any groups larger than 5, they will have 0 guests attending their ceremony. So, I had an idea over the weekend for making a composition that could extract live twitter comments from a specific URL and allow them to be displayed in a creative way so that during the "ceremony" so they could see a live realtime display of all the family and friends that are supporting them on their special day.

After a little research I thought the idea would be impossible since there are no twitter specific nodes yet but then ran into a little bit of hope when I saw that I could grab the twitter page data using the Fetch Data node and realized that each tweet begins with: [p class="TweetTextSize TweetTextSize--normal js-tweet-text tweet-text" lang="en" data-aria-label-part="0"] and ends with [/p].

Is there a way to strip out all the other data/information that gets fetched too and just leave the text information that I could turn into a list and do something creative with?

Any help would be appreciated.

Comments

Using split text & replace

Bodysoulspirit's picture
Submitted by

Using split text & replace text nodes is the quite dirty way I guess, maybe possible creating an XML data type from the html and parse it using the tree nodes, but you're more skilled than me from some previous discussions of yours regarding that (I think there is a feature request also to parse HTML into a list).

Here is a starting composition that retrieves tweets from the #NationalDoctorsDay twitter URL and display them changing every x seconds. I used the "live" tweets URL (https://twitter.com/search?q=%23NationalDoctorsDay&src=trend_click&f=live) but for some reasons it's still the trending ones that seem to be loaded. Maybe creating a wrong list using wrong splitters (perhaps live tweets don't start with "data-aria-label-part="0" or I cut the live tweets HTML code part, or it's cached somewhere somehow, to be checked).

It converts html characters to text & turn hashtag codes into hashtags, but not sure if this works if several hashtags are used in a tweet, and doesn't remove general links or picture links.
Maybe using the same technique you can also retrieve the @ of who sent the tweet.

Hope this helps.

PS why don’t they postpone the wedding ?

Oh! Thank-you Bodysoulspirit!

cwilms-loyalist's picture
Submitted by

Oh! Thank-you Bodysoulspirit! A sample composition was much more than I was asking for, thank-you so much! I was playing with a few techniques but I really like your way, it gives a much cleaner output than I was getting. Hmmm, that gives me a few ideas too. Much appreciated.

I'm not sure why they aren't postponing the wedding, in love I suppose. :) They are going to reschedule the reception for later in the summer or in the fall (hopefully). I just thought if I can cobble this together in time it might make their day a little more special. We'll see.

Great find Jean Marie,

Bodysoulspirit's picture
Submitted by

Great find Jean Marie, usually those services tend to be way more expensive for a 15 sec refresh rate.
I’ll keep this website in mind too.

Chris unless you think more than 10 persons might tweet in 15 seconds, you could still I guess keep the tweets in a list and append new ones. to it. Haven’t tried though, guess the trickier part is to avoid duplicates