Slick tweeting

Red Hen tweets. But the process of tweeting takes too much human attention.

Can we crowdsource the tweeting and automate the move from proposed tweet to published tweet, with only something like a click of approval, and maybe some light editing, by a Red Hen manager? That's the task. Would you like to accomplish it?

If so, write to

and we will try to connect you with a mentor.

Here is the background:

See The Crowing Rooster, Red Hen's flack for the timeline of tweets.

There is a Google Form for proposing tweets from Red Hen. See Propose a tweet from @redhenlab .

When someone submits a proposal, it flows to a Google spreadsheet (

In the early days of Red Hen tweeting, if a Red Hen Manager approved of a proposed tweet, the manager performed cut-and-paste operations to create an html file on See the early tweets for examples of this operation.

But just now, we have a better, easier, more automatic process for creating tweets:

On Mar 19, 2015, at 12:07 AM, Broadwell, Peter <> wrote:

Hi Mark and Francis,

A prototype of the tweet templating system is up on Babylon. You can see it at work by browsing to the following URL:

Opening this URL runs the ‘tweet.php’ script in the /var/www/redhen/ folder on Babylon. The script deduces from the ‘?id=2015-03-16’ in the URL that it should look for tweet-specific data in the 2015-03-16redhentweet.txt file and then uses this data to generate the page HTML.

Here’s what /var/www/redhen/2015-03-16redhentweet.txt looks like, for convenience:

VIDEO: /redhen/tweets/SilvaMonologueOnRats.mp4

CAPTION: Blend: two rats, two human beings. #JamesBond #Skyfall #blend #DanielCraig #JavierBardem.

NOTE: Hat tip to John Billingsley for proposing this tweet.

NOTE: Original source: <a href=""></a>.

The file isn’t exactly in YAML format, which turns out to have some problems with reserved characters (including colons and quotation marks, unfortunately) and generally seems like overkill for this application.

But in any case, as you can see the format is quite straightforward and pretty self-explanatory. The content after each TAG: can be anything, including HTML, as long as it doesn’t contain a newline (wrapping around to the next line in the text editor is fine, however).

So to publish a new tweet, you’d just need to create a new /var/www/redhen/DATE_OR_OTHER_IDredhentweet.txt file and then tweet out the appropriate URL. The only field that’s strictly required in the .txt file is the VIDEO: tag. Also, the template only supports one CAPTION: value, but you can add as many NOTE: entries as you like. At present, the system automatically appends the @redhenlab, “Propose a tweet… ” and the URL of the page at the end of the notes listing.

Please let me know if you’d like to change anything about the data file format, including the types of tags, as well as any other concerns (are you happy with the base URL?). And of course, the beauty of a templating system is that we can continue to tweak the format of the output page, as long as the underlying data is consistent.

Finally, as Francis noted, it would be fairly easy to convert the existing tweets to this system retroactively. We’d just need to create new DATEredhentweet.txt files for each, and then perhaps replace the contents of the DATEredhentweet.html files with a redirect to the new URL, something like:




<meta http-equiv="refresh" content="0;url=">




Just to ensure that the links in the previous tweets still work.



One extra operation that would need to be accomplished is the creation of the video clip. We have a procedure for taking clips, explained at Clips for Turner Students. If you are interested in taking on the slick tweeting task, ask for access to that page. As you can see from earlier tweets, which include the important commands for making the html page which we include as a citation in the tweet itself, the command for making a clip includes these operations:

sweep 2015-01-15; clip 2015-01-15_1800_US_CNN_Wolf.mp4 16:23-16:41 ~/Clips/redhen/tweets

To perform this operation requires taking some information from the Edge Search Engine and then using it to perform operations on the command line. One needs to:

  1. know the name of the file in the Red Hen archive from which the clip comes (in this case, 2015-01-15_1800_US_CNN_Wolf.mp4); it comes from the text or metadata page for a given broadcast;
  2. move to the directory that contains that file (2015-01-15)
  3. and perform the clip command with the following arguments:
    1. the name of the file (e.g. 2015-01-15_1800_US_CNN_Wolf.mp4)
    2. the time interval of the clip (e.g. 16:23-16:41)
    3. the location where the clip should be placed (e.g. ~/Clips/redhen/tweets)

Details available on request.