Hamburger Music

Hamburger Music is a generative poetry project that began in the summer of 2014.

It’s powered by a python script that scrapes words and phrases from Youtube closed -captions. In turn, the snippets of prose created by this script are used to power my personal twitter account and a poetry blog of the same name.

It was written by Elon Bing, a talented young developer from the Netherlands.

Some Examples

I am God…
little bit to deal with there.
Those lost memories…
you’re actually at.
Now I am just holding on to it

I’ve given you 100% already
I secretly love you 100%
I’ve given you 100% already

How it Works

When run, the script performs the following:

  1. Selects a random Youtube video
  2. Scrapes one or more lines from the selected video's closed-captions
  3. Places those lines on top of each other
  4. Outputs the resulting combination (or single caption) as a .txt document
  5. Repeats (x) times, if noted

That’s it! After you run it, you'll up with a folder full of .txt documents with which you can do whatever you like. It’s a great way to generate lots of random snippets of writing.

Note that the closed captions fetched from YouTube are only those that were entered in manually (getting automated captions is kind of complicated).

Structure & Variables

"" lays out the variables and filters we can use to control the output of this script:

This controls the amount of "lines" that you want in your poem. As such, this also determines how many captions are scraped. So, as an example, setting it to 5 might get you something like:
No? ok… *crying intensifies*
But then again
Are more likely to receive clicks.
Is showing to potential customers.

The minimum length in characters for a caption. This was included so that we could avoid single letters or two letter words from being entire lines (though if you're into that kind of thing, just comment it out!)

The amount of lines scraped from a single video. Setting this to a higher number gives higher performance but cuts down on the output’s “randomness”.

This is so that the script outputs your poems as .txt documents. Setting this to "False" will print the result directly in the terminal.

This setting allows you to repeat the script after it finishes creating its poem.

There are a few different styles of this variable:

xrange(x,y) - Allows you to return anywhere from x to y words. Setting this to (3,6), as shown in the example above, will only return captions in that word range.

[w,x,y,z] - Allows you to specifically select multiple word number constraints. So in the example above, [1,3,7,8], will only return captions with either one, three, seven, or eight words.

[x] - Will only return captions based on a single variable. Above, we use [6] as an example, which will only grab captions with six words.

Note that WORDRANGE will not truncate or modify captions. It simply returns captions that meet that criteria. Also note that only one WORDRANGE variable type can be used at once.

Setting this to "True" will capitalize the first letter of each line. Setting it to "False" will return raw formatting (which may or may not be capitalized).