Fix keying

This commit is contained in:
Huy Ngo 2024-08-15 16:03:05 +07:00
parent 28dd345219
commit 85ebe76f5f

View file

@ -61,10 +61,10 @@ def get_text(element, links, images):
return f'<underline>{element.text}</underline>'
for a in element.find_all('a'):
soup = BeautifulSoup("", "html.parser")
if (element['href'] != element.text
and 'mention' not in element.get('class', [])
and 'tag' not in element.get('rel', [])):
links.append(a.href)
if (a['href'] != element.text
and 'mention' not in a.get('class', [])
and 'tag' not in a.get('rel', [])):
links.append(a['href'])
new_tag = soup.new_tag('a')
new_tag.string = '&lt;cyan>' + a.text + '&lt;/cyan>'
a.replace_with(new_tag)