For the mid-term assignment, I wanted to make something related to music. I have always been fascinated by how mashups can just put songs together and create something more than the sum of their parts. Which is also in line with the principles of constrained poetry.

So I made a discord bot which you can summon like this:

1
/mashup-make artist1:eminem artist2:the weekend number_of_lines:6

And the result looks something like this:

Which is basically random lyrics from random songs of the two artists, put together.

Some things I encountered along the way:

  1. The bot mashes up lyrics and the end-product might contain nsfw words which might not be suitable for all audience. So I decided to use an nsfw filter, and there’s a customizable npm package called bad-words.
  2. How I can just copy paste 🐦 into text
  3. When including a piece of text into a url as a query parameter, one needs to replace the newlines by %0A and spaces by %20, or else the url would be ‘malformed’
  4. If your discord bot is taking too much time, you need to use deferReply to let it work its magic because by default discord expects a response in 3 seconds.
  5. For some reason, genius.com has different markups for lyrics pages, which makes it difficult to parse using a single template. What’s stranger is it has different markups for the same page for logged-in versus incognito users.