Replace soup.select with soup.find(id).

This commit is contained in:
voussoir 2022-10-15 22:35:37 -07:00
parent e843770f3c
commit 3ec799302d
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -104,7 +104,7 @@ def linkchecker(do_external=True):
response = session.get(url)
soup = bs4.BeautifulSoup(response.text, 'html.parser')
if result.url_parts.fragment:
if not soup.select(f'#{result.url_parts.fragment}'):
if not soup.find(id=result.url_parts.fragment):
result.exc = BrokenAnchor(f'Broken anchor: #{result.url_parts.fragment}')
links = extract_links(url, soup)
for link in links: