Easily write Twitter threads with ThreadStart

Whenever I write a Twitter Thread I carefully lay out my planned tweets in advance in a text editor. After manually adjusting my sentences to have tweetable parts, I tweet them out one by one.

Quite a cumbersome work, where ThreadStart can do the heavy lifting for me instead:

Creating a Twitter thread without guidance is hard. ThreadStart makes it easy for people to create great content on Twitter. We’ll help you craft a killer set of tweets!

Let’s test it out soon!

ThreadStart →

Cleverly Cropping Images on Twitter using AI

To crop uploaded images, Twitter doesn’t simply cut them off starting from the center. After first having used Face Detection, they – in 2018 already – switched to AI to cleverly crop uploaded images.

Previously, we used face detection to focus the view on the most prominent face we could find. While this is not an unreasonable heuristic, the approach has obvious limitations since not all images contain faces.

A better way to crop is to focus on “salient” image regions. Academics have studied and measured saliency by using eye trackers, which record the pixels people fixated with their eyes. In general, people tend to pay more attention to faces, text, animals, but also other objects and regions of high contrast. This data can be used to train neural networks and other algorithms to predict what people might want to look at. The basic idea is to use these predictions to center a crop around the most interesting region.

💡 Note that depending on how many images you upload, Twitter will use a different aspect ratio.

What I find weird is that this clever cropping only works on their website, and not in embeds nor other clients. Take this tweet for example, embedded below:

When viewed on the Twitter website it does use the clever cropping:

Now, it wouldn’t surprise me that Twitter hides this extra information from 3rd party clients, given that they basically imposed a no-fly zone back in the day.

Speedy Neural Networks for Smart Auto-Cropping of Images →

Tweet from the Firefox Address Bar by adding a Bookmark

In succession to Tweet from the Chrome Address Bar by adding a Custom Search Engine, you can also do this in Firefox. Simply define a bookmark (containing a %s wildcard) with a linked keyword and you’re good to go:

  • Name: Compose Tweet
  • Location: https://twitter.com/compose/tweet?text=%s
  • Keyword: tweet

You can now use the tweet keyword to start tweeting from the Firefox Address Bar.

~

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

Tweet from the Chrome Address Bar by adding a Custom Search Engine

TIL: Chrome allows you to define a Custom Search Engine (CSE) by which you can search sites. The cool part is that you’re not really limited to search only, and that you can abuse these CSEs to become more productive. In this post I’ll show you how to tweet from the Chrome Address Bar.

🦊 Firefox User? You can achieve the same result by adding a bookmark.

~

TIL: Custom Search Engine

The idea was sparked by this tweet by Rowan Merewood. Rowan created a CSE to quickly go to a Zoom meeting by simply typing zoom meeting-id in the Chrome Address Bar.


Don’t mind the word “Search”: Upon hitting ENTER the browser won’t search Zoom but will directly go to the Zoom meeting with ID 123456789.

A Custom Search Engine (CSE) is defined by three parameters:

  • Search Engine: The name that will be shown in the Chrome Address Bar when typing in keyword
  • Keyword: The keyword that needs to trigger the Search Engine
  • URL: The URL that will be visited once you press enter. Use %s where you want your “search term” to appear.

Here’s how Rowan has define his Zoom CSE:

~

DuckDuckGo’s !tw command

Earlier today I saw Šime Vidas tweet about using DuckDuckGo’s !tw command interpretation to quickly compose a new tweet.

As he uses DuckDuckGo as his default search engine, the trick works fine from the address bar:

  1. The Address Bar will pass the entered term to search DuckDuckGo
  2. DuckDuckGo will interpret the !tw prefix and redirect to Twitter’s Compose Dialog

For users like me, who don’t use DuckDuckGo as their search engine, that won’t work.

~

1 + 1 = 2

Combining both ideas, I came to create a Custom Search Engine for Chrome that will allow me to quickly tweet from the Address Bar:

I’ve define a CSE so that the tw keyword will directly go to Twitter’s Compose Dialog. To define this CSE yourself, go to chrome://settings/searchEngines and add a new CSE with the following details:

  • Search Engine: Compose Tweet
  • Keyword: tw
  • URL: https://twitter.com/compose/tweet?text=%s

From now on you can compose a tweet by simply typing tw This is a tweet in the Chrome Address Bar.

Combine that with CMD+L, just like Šime did, and you can quickly tweet out links:

  1. Visit URL
  2. Hit CMD+L to focus the Address Bar
  3. Hit CMD+← to put the cursor before the URL
  4. Type in tw (with space) and hit enter

Cool!

~

Call to developers

I see lots of uses for this. You could create these kind of productivity shortcuts to go quickly to Twitter profile pages, visit NPM packages, auto-archive URLS on The Wayback Machine, etc. (Ab)using CSEs like this once again underlines the importance of bookmarkable URLs and the ability to precompose data along with that.

Do note that many sites (such as the mentioned Twitter, GitHub, NPMJS, etc.) already provide CSEs to actually search them. Same goes for WordPress blogs, such as this one right here: simply enter bram.us searchterm in the Chrome Address Bar and after hitting ENTER it’ll search this blog for the given searchterm.

~

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

Extract URLs, usernames, hashtags, etc. from tweets with twitter-text-js

If you ever have to work with Tweets, then twitter-text-js will surely come in handy:

A JavaScript utility that provides text processing routines for Tweets. The library provides autolinking and extraction for URLs, usernames, lists, and hashtags.

The following snippet for example will autolink the hashtag and the mentioned username:

twitter.autoLink(twitter.htmlEscape('#hello < @world >'))

Installation per NPM/Yarn:

npm install twitter-text

twitter-text-js (GitHub) →

Turn a Twitter thread into an ad-free, single page with @threader_app

Now this is darn handy:

The tweet below for example …

… becomes this page:

All media added to tweets are also embedded 🙂

Easily create high resolution Twitter screenshots with “Screenshot a Tweet”

Nice new tool by Cameron Adams (The Man in Blue): just enter the URL of a tweet, et voila: you get a screenshot – without any cruft and in a decent resolution – in return.

To do this on the technical side, I fetch the tweet text using Twitter’s API and then analyse the author’s profile picture using Color Thief; this gives me a nice background colour that matches their profile picture, which I then layer with a lightly transparent copy of their Twitter header to produce a good-looking backdrop to their tweet.

To capture the final image, I use the excellent html2canvas to render all the HTML to a canvas element and then save out the pixel data. Bingo! You get an image of your tweet.

Supports link and hashtagh highlighting, but would also love to see image support. That’d really complete it.

Screenshot a Tweet →
Screenshot a Tweet introductory post →

Accessing a tweet using only its ID (and without the Twitter API)

See the Pen Twitter Tweet URL Generator by Bramus (@bramus) on CodePen.

Today I learned that Twitter totally ignores the username in the “tweet detail route” on their website. This allows you to view details of a (public) tweet when knowing only its ID, without needing to access the Twitter API (which is the default geeky approach I was first going to take).

Embedded above is a small tool I built to help you with that. Simply enter the Tweet ID and hit “Generate URL”.

~

Twitter’s tweet detail route has the form of https://twitter.com/{userName}/status/{tweetId}. When passing in a tweetId with a non-matching/invalid userName, the Twitter website will automatically redirect to the URL with the correct userName

Example: To see the contents of the tweet with id 932586791953158144 just visit https://twitter.com/anyuser/status/932586791953158144 and you’ll be redirected to its actual URL: https://twitter.com/bramus/status/932586791953158144

Handy 😊

~

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

When Twitter Refuses to Delete Abusive Tweets …

Shahak Shapira:

Over the last months, I reported about 300 hate tweets. Twitter failed to delete most of them, so I sprayed them in front of their office.

Nice guerilla action. Hopefully this will now get Twitter’s attention.

Sidenote: Dustin Curtis recently tweetranted (ranttweeted?) a few things Twitter could do to improve. Of course the topic hate speech / abuse was mentioned, as it is a problem: