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 (https://docs.google.com/spreadsheets/d/1iovWjqpP4Q14c6TA5yf1OZxzE9WUZRvh0btrjdwKdII/edit#gid=119949981).
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 babylon.library.ucla.edu. 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 <broadwell@library.ucla.edu> 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:
http://babylon.library.ucla.edu/redhen/tweet?id=2015-03-16
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="https://www.youtube.com/watch?v=C0dFsAtAlEo">https://www.youtube.com/watch?v=C0dFsAtAlEo</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 babylon.library.ucla.edu/redhen/tweet 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:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="refresh" content="0;url=http://babylon.library.ucla.edu/redhen/tweet?id=2015-03-16">
</head>
<body></body>
</html>
Just to ensure that the links in the previous tweets still work.
Cheers,
Pete
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:
- 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;
- move to the directory that contains that file (2015-01-15)
- and perform the clip command with the following arguments:
- the name of the file (e.g. 2015-01-15_1800_US_CNN_Wolf.mp4)
- the time interval of the clip (e.g. 16:23-16:41)
- the location where the clip should be placed (e.g. ~/Clips/redhen/tweets)
Details available on request.