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.
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 Harmful.
When run, the script performs the following:
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).
"Settings.py" 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:
POEM_LENGTH=5 MINSUBLENGTH=3 MAX_LINES_PER_VIDEO=2 SAVE_TO_FILE=True POEM_BASENAME="Poem-" POEM_EXTENSION=".txt" POEM_PATH="/path/to/poetry/dir/" NUMBER_OF_POEMS=50 WORDRANGE=xrange(3,6) #WORDRANGE=[1,3,7,8] #WORDRANGE= CAPITALIZE=True POEM_LENGTH
No? ok… *crying intensifies* But then again Are more likely to receive clicks. Is showing to potential customers. THIS MORNING.
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  as an example, which will only grab captions with six words.
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).