add text for fancy output and remove previous print (were testing)
This commit is contained in:
parent
4247f1ac83
commit
c35f7454a2
@ -52,7 +52,7 @@ def get_product_url_list(url_category_page, url):
|
||||
def main():
|
||||
# init
|
||||
url = "https://books.toscrape.com/"
|
||||
category = "fantasy"
|
||||
category = "default"
|
||||
|
||||
# get functional variables
|
||||
soup = get_html(url)
|
||||
@ -64,17 +64,17 @@ def main():
|
||||
|
||||
# check if multiple page and get url list
|
||||
url_list = check_for_pages(category_url)
|
||||
print("Liste des URLs des pages: ", url_list)
|
||||
# print("Liste des URLs des pages: ", url_list)
|
||||
|
||||
# get product list for each url_list, extend the main product url list with
|
||||
product_url_list = []
|
||||
for i in url_list:
|
||||
product_url_list.extend(get_product_url_list(i, url))
|
||||
# print("Liste des URL des produits: ", product_url_list)
|
||||
# print("Longueur de la liste: ", len(product_url_list))
|
||||
print("Nombre de livres: ", len(product_url_list))
|
||||
|
||||
|
||||
# combine with phase 1 and write in csv for each url from product_url_list named with category
|
||||
# combine with phase 1 and write in csv for each url from product_url_list named with category
|
||||
data = []
|
||||
for page_url in product_url_list:
|
||||
page_soup = get_html(page_url)
|
||||
@ -83,7 +83,8 @@ def main():
|
||||
# print(phase1.get_data(page_soup, page_url))
|
||||
data.append(phase1.get_data(page_soup, page_url))
|
||||
|
||||
phase1.data_output(data, category)
|
||||
print("Done.\n Fichier " + phase1.data_output(data, category))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user