defget_word(): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36' } url = 'https://www.oxfordlearnersdictionaries.com/wordlists/oxford3000-5000' req = requests.get(url,headers=headers) html = req.text soup = BeautifulSoup(html,'lxml') ul = soup.find('ul',class_="top-g") for x in ul: try: word = x.select('li > a') except Exception as e: pass else: if word: result.append(word[0].text) result.sort() res = set(result) return res