Random
Random
If you haven’t noticed, I’m using my site as a sorta makeshift Github. The code snippets here are constantly updated as they’re getting tweaked and updated with functionality.
One of the snippets I use to game search rewards is below. It grabs the top 250 article titles from today’s Wikipedia and adds words in front of it to sounds human-ish. Free to use / copy if you’re also up to no good.
random.py
import wikipediaapi
import random
user_agent = "WackaMole/1.1" # this can be anything
wiki_wiki = wikipediaapi.Wikipedia(user_agent=user_agent)
# Get a list of featured articles
featured_articles_page = wiki_wiki.page("Wikipedia:Featured_articles")
featured_articles = list(featured_articles_page.links.values())
# Take the top 250 articles
random_top_250_articles = random.sample(featured_articles, 250)
# Save the titles to a list
WIKI = [article.title for article in random_top_250_articles]
# Search terms
TERMS = ["Describe ", "What is ", "Photos of "] # add in more terms here
for i in range(1,30):
value = random.choice(TERMS) + random.choice(WIKI)
print(value)
Output
Photos of Pokémon Channel
Describe William Hardham
What is Fez (video game)
What is Heian Palace
Describe Missouri Centennial half dollar
What is PlayStation (console)
Describe White Horse (Taylor Swift song)
[...]