Friday, March 6, 2015

Customizing a Twitter feed widget

I haven't posted here in way too long, partly because the blog had veered so far toward e-book publishing that I worried that posting about anything else was distracting. I think I just worry too much. Today I return to this blog about "pigs" (local food, buying local, etc.), "gourds" (creating beautiful things, by hand or by bits), and "wikis" (technology, ebooks, twitter, publishing, etc.) I hope you enjoy what I share here.

This post comes from a Twitter workshop series that I've been doing in Catalan over at Dra. Piula. I mean to translate it into English, but for now I may just do highlights. We'll see. But I thought this post about customizing a Twitter feed widget would interest a lot of English speakers as well. Here goes:


You may already know how to create a Twitter widget for your blog or WordPress. It's not hard. You go to Settings in Twitter, click Widgets on the left, Create New on the right, and then choose criteria for the contents of the Twitter feed. Then click Create, and copy the code to your blog.

But how can you go beyond Twitter's basic search options? At first glance, it looks like you have to choose between a User timeline OR Favorites OR a List OR Search OR a Collection:


But what do you do if you want a user's timeline with a certain hashtag? What if you only want to someone's tweets in English? :) Or you want to see all of the tweets of a group, but only regarding a particular topic?

I'll show you.

To begin, make a normal widget using the Search option and enter the first topic that interests you into the Search Query box:


Notice that the Preview populates with all of the tweets that satisfy that criteria, which I can promise for Barcelona, means a lot of varied tweets.

Let's search only for tweets in English. Use lang:en (the two letter language code for English. And note that ca is for Catalan, but it doesn't work).


Now let's get rid of tweets that mention FCBarcelona, as much as we may love them, since they tend to block everything else out about Barcelona. Use -FCBarcelona


How about only tweets (and retweets) by me? Use from:lizcastro


The possibilities are endless. You can precisely tailor your Twitter feed gadget to your audience, without having to limit your activity on Twitter itself.

What other criteria can we use for a search? Here's all the ones I found:
  • To search for a given word or hashtag, just list it: Barcelona, #MWC15, etc.
  • To exclude criteria from the search, use a minus sign: -beach or -from:troll
  • To find tweets in only a given language, use lang followed by the two letter code for the desired language: lang:en or lang:fr. Unfortunately, Twitter doesn't know how to distinguish tweets that are in Catalan, sometimes it thinks they're Portuguese, sometimes Romanian, sometimes Italian. And if I tell it to show me only Catalan tweets, it doesn't show any at all :( 
  • By default, RTs are included. If you don't want them, add exclude:nativeretweets
  • If you want only tweets that contain images, use filter:images
  • If you want only tweets that contain videos, use filter:videos
  • If you want only tweets that contain vines, use filter:vines
  • If you want tweets with links, use filter:links
  • If you want tweets from a given Twitter account, use from:TwitterName (no @ needed)
  • If you want only tweets from verified Twitter accounts, use filter:verified
  • If you want tweets only from the accounts belonging to a given list, use list:list owner name/list name
  • If you want only tweets who have received a given number of replies, use min_replies:n, where n is that number 
  • If you want only tweets with a certain number of favorites, type min_faves:n, where n is that number 
  • If you want only tweets with a certain number of RTs, use min_retweets:n, where n is that number
You can use AND, OR and parentheses to combine criteria:
  • If you separate each criteria with a space, Twitter concludes that you want only tweets that satisfy all the criteria. As if you typed an AND between them. So Catalan independence will get you tweets that include both Catalan and independence.
  • If you separate each criteria with an OR, Twitter will show you tweets that satisfy either one criteria or the other.
  • If you want to exclude a criteria, use the minus sign (equivalent to NOT).
  • You can use parentheses to combine criteria in various ways (Catalan OR independence) lang:en would get you all tweets in English that talk about either Catalan or the independence (so you might get Catalan books or Scottish independence, for example).
Are you thinking about all the possibilities?
  • Combine from:username and min_retweets:100 to get only the user's most popular tweets
  • Combine from:username and lang:en to get only a user's tweets in a given language
  • Combine from:username and -lang:en to get only a user's tweets that are not in English
  • Combine from:username with a search term to see only the user's tweets that are about a given topic
  • Combine list:listowner/listname and -from:username to get all of the tweets from a list, except for from one person in particular
  • And so on and so on.
To sum up, let's look at that Twitter feed we created, with tweets from me, about Barcelona, not including FCBarcelona, and only in English (on the left) compared with my standard Twitter feed on the right:

results regular_feed

No comments:

Post a Comment

More of my books