all repos — donkey @ 2a98ded5cd847a031cc1e97ddb64aa452cb213b0

The main backend for forlater.email

Skip if no hrefs
Anirudh Oppiliappan x@icyphox.sh
Sat, 03 Apr 2021 16:28:37 +0530
commit

2a98ded5cd847a031cc1e97ddb64aa452cb213b0

parent

dc80dc1a0d50b02336a12040d4dd62baa2f20000

1 files changed, 5 insertions(+), 2 deletions(-)

jump to
M app/html.pyapp/html.py

@@ -25,8 +25,11 @@ def fetch_page(url):

res = requests.get(url) soup = BeautifulSoup(res.content, "lxml") for a in soup.find_all("a"): - if not is_absolute_url(a["href"]): - a["href"] = urllib.parse.urljoin(url, a["href"]) + try: + if not is_absolute_url(a["href"]): + a["href"] = urllib.parse.urljoin(url, a["href"]) + except KeyError: + pass return {"title": soup.title.string, "html": str(soup.html)}