Generate embedded HTML tweets in Python. Can be imported as a module or run from the command line.
Python JavaScript CSS
Pull request Compare This branch is 40 commits ahead of jmillerinc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Blackbirdpy is a set of scripts and styles for quickly embedding "live" tweets in blog posts or other web articles. All links within the tweet, including URLS, screen names, and hashtags are fully clickable. It accesses the Twitter API, but does no user tracking, cookie planting, or other sketchy business.

There are three parts to blackbirdpy:

  1. A Python script that takes a tweet's URL as its command-line argument and returns a chunk of HTML for embedding. The HTML puts the tweet in a <blockquote> structure and is intended to look decent in an RSS reader.
  2. A CSS file that styles the elements of the embedded tweet.
  3. An AppleScript that gets the URL of the frontmost Safari window and passes it to the Python script, returning the HTML chunk. I use this in a TextExpander snippet, so I can simply type ;tweet in my text editor and insert the HTML chunk into the article I'm writing.

The idea is to provide an embedded tweet that looks like a tweet (without the follow, favorite, retweet, etc. buttons) and which degrades to a simple quotation when viewed in RSS.

Here's an example, which sort of matches what you'd see in an RSS reader:

Embedded tweets don’t have to be fragile or track cookies:…
  — Dr. Drang (@drdrang) Thu Jul 12 2012 11:34 PM CDT

If you follow the link in the tweet, you'll see several tweets.

Blackbirdpy was forked from Jeff Miller's project, , which was, in turn, inspired by Robin Sloan's Blackbird Pie, a JavaScript tool for embedding tweets that Twitter seems to have removed in favor of a more complicated embedding code that I don't like the look of.