crawler fix
This commit is contained in:
parent
9ee285cf95
commit
1f08432fbf
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user