Created
August 16, 2019 11:11
-
-
Save r-darwish/7bc8caf11087ad7a0824e0d33dcb2cda to your computer and use it in GitHub Desktop.
Metal band name generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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