From bf0cf3862464b741fac3044c7898c1aeb9e9cd62 Mon Sep 17 00:00:00 2001 From: noa Date: Wed, 3 Jan 2024 10:33:14 +0000 Subject: Move all commands into commands/ subdirectory --- commands/wotd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 commands/wotd (limited to 'commands/wotd') diff --git a/commands/wotd b/commands/wotd new file mode 100755 index 0000000..933a021 --- /dev/null +++ b/commands/wotd @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +from urllib.request import Request, urlopen +from bs4 import BeautifulSoup + +req = Request("https://www.oed.com/", headers={"User-Agent": "Mozilla/5.0"}) +soup = BeautifulSoup(urlopen(req), "html.parser") + +#wotd_div = soup.find('div', attrs={'class': 'wotd'}) +#wotd_word = word_div.find('a').get_text() +wotd_word = soup.find("div", attrs={"class": "wotd"}).h3.a.get_text() + + +print("The oxford english dictionary word of the day is " + wotd_word + "!") + -- cgit 1.4.1-2-gfad0