Live Notes: Searching Twitter within a cluster…

So I just posted this question on reddit:

Say I’m at a conference. People are tweeting using the #conf20XX hashtag.

I’m also a climber – and it would be nice to find someone to go climbing with while I’m here. So what I want to do is find all of the people who have used the #conf20XX hashtag who have also separately used the word ‘climbing’ in a different tweet – is this a possible thing?

and a redditor replied with this:

Difficult to do. I would try the following.

Search conference hashtag. Find 5 or 6 interesting and engaged looking tweeters
Search – climbing (from:@handle1 OR from:@handle2 OR …)

It would be pretty tedious, but you’d find a few people after a while.

Which I think I can do with code… Let’s find out.

This is a live notes post. It is of very low interest to almost all readers, but I do believe that the more open my work is, the better that work goes.   These are posts mostly written for me, but if you arrived here from a search engine and it looks like I once had a problem that you have now then feel free to drop me a line and I’ll put things into order a little bit.

#29/4/16-19:03:21 GMT+1:

First thing I want to know is: does the OR…OR…OR thing work for a large number of users…  I’m going to use a handy dataset I happen to have: UK members of Parliament!

#29/4/16-19:05:15 GMT+1:

So this is my list: mps

I’m going to see if I can produce the very long search string in VIM.

It’s formatted like this:


Jo Cox MP  @Jo_Cox1
Jamie Reed @jreedmp
Guto Bebb @GutoBebb
Ed Vaizey  @edvaizey
Danny Kinahan @DdeBK
Ann Clwyd  @AnnClwyd
Alan Mak  @AlanMakMP

and I just want to… wait… I have another file.


#29/4/16-19:07:20 GMT+1:

Yes. screenamesOnly Let’s use that one.


#29/4/16-19:08:51 GMT+1:


:%s/^/OR from:

got me most of the way…. and I have this: searchTwitter


Let’s give it a go. I’m going to search for any time an MP has mentioned “disability”


#29/4/16-19:11:48 GMT+1:

Screen Shot 2016-04-29 at 19.11.04Well that was fun… Maybe 450  account was a little strong… Let’s start smaller


#29/4/16-19:13:34 GMT+1:

Screen Shot 2016-04-29 at 19.13.20

Technically an improvement…

#29/4/16-19:15:59 GMT+1:

Just tried on a tiny example  (two MPs) and it works… I wonder what the upper limit is…

#29/4/16-19:19:33 GMT+1:

Okay, the longest version I can find is (linked to results):

disability ((from:@ACunninghamMP OR from:@AMMorrisMP OR from:@AMcDonnellMP OR from:@APMiller1949 OR from:@AVMitchell2010 OR from:@AdamAfriyie OR from:@AidanBurleyMP OR from:@AlanDuncanMP OR from:@AlbertOwenMP OR from:@AlecShelbrooke OR from:@Alison_McGovern OR from:@AlistairBurtMP OR from:@AlunCairns OR from:@AmberRuddMP OR from:@AnasSarwar OR from:@Andrew4Pendle OR from:@AndrewBridgenMP OR from:@AndrewGeorgeLD OR from:@AndrewJonesMP OR from:@AndrewRosindell OR from:@Andrew_SelousMP)

which is a few (21) but only a few.   But the usecase is relatively small – the initial set is likely to be less than 60 and that will just mean I split into two options. I think we have a winner.



Leave a Reply