aboutsummaryrefslogtreecommitdiff
path: root/on_this_day.py
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-09-29 21:34:40 -0500
committerMark Powers <markppowers0@gmail.com>2020-09-29 21:34:40 -0500
commitafaa20032fc773b9d2b0a1b7ac34ccabc70458d3 (patch)
tree19557bec2cc9dcf6f13445b1721496accd3ecac8 /on_this_day.py
parent0f9519ade58173de0b564058ff7588b471cd7c65 (diff)
Add Peanuts
Diffstat (limited to 'on_this_day.py')
-rw-r--r--on_this_day.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/on_this_day.py b/on_this_day.py
index f8abb8e..5813f18 100644
--- a/on_this_day.py
+++ b/on_this_day.py
@@ -6,7 +6,7 @@ from bs4 import BeautifulSoup
from config import config
def get_on_this_day():
- return "<h1>On this day</h1>%s%s%s%s" % (get_old_news(), get_calvin_and_hobbes(), get_today_wikipedia(), get_today_wikiquote())
+ return "<h1>On this day</h1><ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>%s" % (get_old_news(), get_peanuts(), get_calvin_and_hobbes(), get_today_wikipedia(), get_today_wikiquote())
def get_old_news():
print("getting old news")
@@ -49,3 +49,12 @@ def get_calvin_and_hobbes():
else:
return ""
+def get_peanuts():
+ print("getting peanuts")
+ comic_date = date.today().strftime("%Y/%m/%d")
+ full_url = "https://www.gocomics.com/peanuts/%s" % comic_date
+ r = requests.get(full_url)
+ soup = BeautifulSoup(r.text, features="lxml")
+ comic_src = soup.select(".item-comic-image")[0].img["src"]
+ return '<div><a href="%s">Peanuts</a></div>' % (comic_src)
+