From 1f08432fbf416d18b317ae7c8e1fb0cca7dbe8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Koz=C5=82owski?= Date: Sat, 7 Jan 2023 14:59:07 +0100 Subject: [PATCH] crawler fix --- crawler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crawler.py b/crawler.py index dcc639a..7cfbdad 100644 --- a/crawler.py +++ b/crawler.py @@ -11,7 +11,7 @@ MAIN_URL = "https://pl.wikisource.org/" def get_page_data(page_element): time.sleep(0.5) doc = requests.get(MAIN_URL + page_element['href']) - doc_soup = BeautifulSoup(doc.text, 'lxml', from_encoding="utf-8") + doc_soup = BeautifulSoup(doc.text, 'lxml') text = doc_soup.find("div", {"class": "pagetext"}).next_element image_url = doc_soup.find("div", {"class": "prp-page-image"}).next_element['src'] return {"title": page_element['title'], "href": MAIN_URL + page_element['href'], "image_url": image_url, "text": text.text}