Skip to content

Commit

Permalink
feat: add iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquimds committed Sep 17, 2024
1 parent 8f0d81d commit 2454a4a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions wagtaillinkchecker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def check_link_sync(link_pk, verbosity=1):
soup = BeautifulSoup(url["response"].content, "html5lib")
anchors = soup.find_all("a")
images = soup.find_all("img")
iframes = soup.find_all("iframe")

for anchor in anchors:
link_href = anchor.get("href")
Expand All @@ -47,6 +48,18 @@ def check_link_sync(link_pk, verbosity=1):
except IntegrityError:
pass

for iframe in iframes:
link_href = iframe.get("src")
link_href = clean_url(link_href, site)
if verbosity > 1:
print(f"cleaned iframe link_href: {link_href}")
if link_href:
try:
new_link = link.scan.add_link(page=link.page, url=link_href)
new_link.check_link(verbosity)
except IntegrityError:
pass

for image in images:
image_src = image.get("src")
image_src = clean_url(image_src, site)
Expand Down

0 comments on commit 2454a4a

Please sign in to comment.