Created
May 31, 2020 13:36
-
-
Save officialcjunior/b1e065a8975356945604f3ab5e432df7 to your computer and use it in GitHub Desktop.
shitposter.py posts a shitpost on Mastodon.
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
# shitposter.py | |
# Requirements : Toot https://github.com/ihabunek/toot and a Unix-like system | |
import urllib.request | |
import random | |
import subprocess | |
word_url = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain" | |
response = urllib.request.urlopen(word_url) | |
long_txt = response.read().decode() | |
words_online = long_txt.splitlines() | |
words_local = open('/etc/dictionaries-common/words').readlines() | |
toot = '' | |
for i in range (random.randint(0,15)): | |
for j in range (random.randint(0,6)): | |
if j%2==0: | |
toot += random.choice(words_online) | |
else: | |
toot += random.choice(words_local) | |
toot += ' ' | |
toot=toot.replace('\n', ' ') | |
subprocess.call('toot post "{post}"'.format(post=toot), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment