synonym not slugified was causing error
This commit is contained in:
parent
b77f85e2da
commit
5260e4fbf5
@ -137,7 +137,7 @@ def get_synonyms(word: str) -> str:
|
|||||||
response = requests.get(syn_url.format(word.lower()))
|
response = requests.get(syn_url.format(word.lower()))
|
||||||
soup = BeautifulSoup(response.content, 'html.parser')
|
soup = BeautifulSoup(response.content, 'html.parser')
|
||||||
synonyms = soup.find_all(['strong', 'span'], {'class': 'syn'})
|
synonyms = soup.find_all(['strong', 'span'], {'class': 'syn'})
|
||||||
synonym_list = [f'\n*{slugify(i.string)}*' if i.name == 'strong' else i.string for i in synonyms]
|
synonym_list = [f'\n*{slugify(i.string)}*' if i.name == 'strong' else slugify(i.string) for i in synonyms]
|
||||||
return (''.join(synonym_list))
|
return (''.join(synonym_list))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user