blob: 933a021c26b667d1262837fc401757335300259d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 + "!")
|