Fix a bunch of bot code and checkin systemd files

This commit is contained in:
RussellChamp committed 2018-11-01 11:05:52 -04:00
1 parent 6770c70068
commit 2a2ed1e064
26 files changed
+222 -137

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/python3
import urllib
from bs4 import BeautifulSoup
import random
@@ -6,7 +7,7 @@ import re
def tumble(url):
# Find the max pages
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
soup = BeautifulSoup(urllib.request.urlopen(url).read(), "html.parser")
pages = soup.findAll("span", "page-numbers")[0].text.split("/")[
1
] # this could totally fail several ways
@@ -17,7 +18,7 @@ def tumble(url):
# Parse a page
soup = BeautifulSoup(
urllib.urlopen(url + "/page/" + str(page)).read(), "html.parser"
urllib.request.urlopen(url + "/page/" + str(page)).read(), "html.parser"
)
article = random.choice(soup.findAll("article"))
quote = article.find("blockquote").text.replace("\n", "")