when some Mention objects hrefs can't be found, try with the name property

todos-and-issues
Alain St-Denis 2024-02-03 09:17:07 -05:00
rodzic 31583d29b8
commit 64044e7452
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -885,11 +885,22 @@ class Note(Object, RawContentMixin):
profile = retrieve_and_parse_profile(profile.id)
if profile:
hrefs.extend([profile.id, profile.url])
else:
continue
for href in hrefs:
links = self._soup.find_all(href=href)
for link in links:
link['data-mention'] = profile.finger
self._mentions.add(profile.finger)
if profile.finger not in self._mentions:
# can't find some mentions using their href property value
# try with the name property
matches = self._soup.find_all(string=mention.name)
for match in matches:
link = match.find_parent('a')
if link:
link['data-mention'] = profile.finger
self._mentions.add(profile.finger)
def extract_mentions(self):
"""