I have a database with ISBN numbers of different books. I gathered them using Python and Beautifulsoup. Next I would like to add categories to the books. There is a standard when it comes to book categories. A website called https://www.bol.com/nl/ has all the books and categories according to the standard.
Start URL: https://www.bol.com/nl/
ISBN: 9780062457738
URL after search: https://www.bol.com/nl/p/the-subtle-art-of-not-giving-a-f-ck/9200000053655943/
HTML class of categories: <li class="breadcrumbs__item"
Does anyone know how to (1) enter the ISBN value in the search bar, (2) then submit the search query and use the page for scraping?
Step (3) scraping all the categories is something I can do. But I don't know how to do the first 2 steps.
Code that I have so far for step (2)
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
webpage = "https://www.bol.com/nl/" # edit me
searchterm = "9780062457738" # edit me
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get(webpage)
sbox = driver.find_element_by_class_name("appliedSearchContextId")
sbox.send_keys(searchterm)
submit = driver.find_element_by_class_name("wsp-search__btn tst_headerSearchButton")
submit.click()
Code that I have so far for step (3)
import requests
from bs4 import BeautifulSoup
data = requests.get('https://www.bol.com/nl/p/the-subtle-art-of-not-giving-a-f-ck/9200000053655943/')
soup = BeautifulSoup(data.text, 'html.parser')
categoryBar = soup.find('ul',{'class':'breadcrumbs breadcrumbs--show-last-item-small'})
for category in categoryBar.find_all('span',{'class':'breadcrumbs__link-label'}):
print(category.text)