Tinderbox Forum

View tweets in Tinderbox

Hi, is it possible to preview existing tweets in Tinderbox? I’ve got a DEVONthink database with tweets (in HTML) I’d like to review in Tinderbox. There’s no special need to use the HTML source, it would also be fine if Tinderbox fetches the URL with $URL and $AutoFetch. I know that it’s not possible to fetch a normal tweet URL because it needs JavaScript, but it is possible with the mobile version https://mobile.twitter.com/. That would be fine but it does not show comments which I’d like to preview too. So I think using the HTML source is the only option left but unfortunately I’ve got no clue of HTML.

I tried to use $OnVisit=runCommand("open "+$URL); with $URL set to a DEVONthink link, but that’s not really what I was looking for. Any ideas?

I’m not quite sure what you’re trying to do here. Could you tell us a bit more about your project?

Assuming you are trying to get tweets into Tinderbox to analyze themes and patterns (as opposed to some sort of live feed into Tinderbox) then you can do something like the following without having to access the Twitter API with Javascript or Python or R or whatever, and without having to parse HTML.

In Safari go to the account from which you want to retrieve tweets (I used Kamala Harris’s account just as an example) and simply select multiple tweets in the timeline and type command-c to copy to the clipboard. Then Edit > Paste and Match Style into a Tinderbox note. If you use the mobile site then the pasted text in the note will look something like this.

Then you can use Note > Explode … to split the text into individual tweets and, if you like, use $Text.contains with regular expressions to grab the number of likes, retweets, replies etc. (You can also split and parse the text using AppleScript or JavaScript, etc. if you are more comfortable with that.)

I did some tracking in early 2016 and Tinderbox scaled well up t0 2000 or so tweets (imported and split in batches) and probably would have done fine with more than that had I needed it to. Below is the kind of “dashboard” (using File > Built-In Prototypes > Dashboard and plot in the Pattern attribute for the agents) that I was able to put together quite quickly, which forced me to realize that, contrary to popular impression, HRC tweeted far more than DJT. And wasn’t retweeted nearly as often.

Sure, I capture bookmarks to tweets I find interesting (for a writing project) with DEVONthink to go. Every week I sync and convert them to HTML. I never really gave a thought how to review this DEVONthink database, but am pretty sure Tinderbox is the place to sort the “garbage” out and give attributes to the important stuff.

Thanks to you (and DEVONthink 3 which used together with Tinderbox 8 is mindblowing) it then should be possible to add (some of the) attributes I used in Tinderbox to the corresponding DEVONthink record with AppleScript (in this use case the most important attribute I plan to “write back” to the DEVONthink record would be something like $UsedInWriting. There’s still a lot of stuff to do for me, but I’m really, really excited to use the Attribute Browser and Hyperbolic view when everything is set up).

What I’m trying to do now is viewing a tweet together with it’s comments (as comments are often more interesting then the tweet itself) in Tinderbox just as it looks like in a browser. I’m not sure if this is possible with (parts of) the HTML source (which I could get from DEVONthink via AppleScript) but I believe it’s not possible via $URL set to the mobile tweet URL and $AutoFetch as this would strip out a tweet’s comments. What I’m looking for is something like this

@sumnerg, thanks for your very interesting answer. It’s not what I’m trying to do right now but I think it will be very useful in the future. Took me a moment to realize what “HRC” and “DJT” stands for but finally I got it :smile:

If you’re able to get the html from DEVONthink into Tinderbox via AppleScript or whatever (I can confirm dragging doesn’t work when ‘kind’ is HTML in DEVONthink) have you tried turning on the Text Pane Selector (Window menu), assigning a template, and selecting the Preview pane?

This “worked”, but Tinderbox crashed quite often during my tests with 6 tweets (and I want to review some thousand tweets, of course split in parts) and now it’s not possible to open the file without Tinderbox crashing.

I (think I) know Tinderbox wasn’t built to hold other documents, if that’s true, how would you review tweets and assign attributes to them? Should I take a look at the twitter API (which would need a lot of learning to accomplish a simple task I’m afraid)? Should I try to first extract the tweet’s text outside of Tinderbox instead of adding the whole HTML source to $Text?

Yes, I too have had limited success trying to view complicated Twitter html in Tinderbox, whereas DEVONthink acts well as a viewer. One option might be to link back from Tinderbox to the DEVONthink item (Copy Item Link or AppleScript/JXA equivalent). Then you could just click the URL key attribute and the tweet with replies will pop up in DEVONthink. You could then do your analysis in Tinderbox, assigning values to attributes, etc., and then, if needed, use AppleScript/JXA to push those values back to DEVONthink.

I haven’t used the Twitter API. You need to apply for a Developer Account and embed various codes, then use a scripting language to retrieve data. Depending on your needs, that might be a good solution.

If Tinderbox crashes at all — especially repeatedly — definitely report it to bernstein@eastgate.com . This is rare, but it’s possible you’re importing a rare data type, or that something about certain Tweets is causing a hiccup.

This is the sort of thing we can often fix very quickly.

Why don’t you send me a small DEVONthink database with some representatively challenging Tweets?

You got mail :slightly_smiling_face:

I also think viewing in DEVONthink is the way to go. It’s not what I had in mind but with $OnVisit set to open the record it should be possible without too much friction. Thanks!