Skip to content

Instantly share code, notes, and snippets.

@r-darwish
Created August 16, 2019 11:11
Show Gist options
  • Save r-darwish/7bc8caf11087ad7a0824e0d33dcb2cda to your computer and use it in GitHub Desktop.
Save r-darwish/7bc8caf11087ad7a0824e0d33dcb2cda to your computer and use it in GitHub Desktop.
Metal band name generator
import requests
from bs4 import BeautifulSoup
from itertools import chain
from random import choice
url = requests.get("https://arctangent.co.uk/line-up/")
soup = BeautifulSoup(url.text, features="html.parser")
bands = [x.text for x in soup.find_all("h2", "grid-title")]
words = set(chain(*[w.split(' ') for w in bands]))
words.discard("&")
def generate():
parts = []
for _ in range(choice([2,3])):
parts.append(choice(list(words)))
return " ".join(parts)
for _ in range(10):
print(generate())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment