aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
+