diff --git a/phase1/main.py b/phase1/main.py index a2968a9..a8864e6 100644 --- a/phase1/main.py +++ b/phase1/main.py @@ -36,6 +36,11 @@ def product_description(soup): desc = soup.find("p", class_='').string return desc +# get category from breadcrumb +def get_category(soup): + bread = soup.find("ul", class_="breadcrumb").find_all("a")[-1].text + return bread + #create a list with all information consecutively # /!\ don't know if that's the best way def get_data(soup, url): @@ -45,7 +50,7 @@ def get_data(soup, url): product_information(soup)['Price (excl. tax)'], product_information(soup)['Availability'], product_description(soup), - "TODO", + get_category(soup), product_information(soup)['Number of reviews'], get_image_url(soup, url) ]