refactor output counters
This commit is contained in:
parent
ebd5f5acd4
commit
b34a5d123c
@ -140,16 +140,19 @@ def main():
|
||||
soup = get_html(url)
|
||||
|
||||
# init counters
|
||||
total_category = len(get_category_list(soup, url))
|
||||
total_books = int(soup.form.strong.text)
|
||||
processed_books = 0
|
||||
|
||||
print(total_books, " à traiter répartis en ", total_category, " catégories.\nGo.")
|
||||
# go ahead for each category
|
||||
for line in get_category_list(soup, url):
|
||||
category = line[0]
|
||||
category_url = line[1]
|
||||
|
||||
total_category -= 1
|
||||
# display what category is processed
|
||||
print("\n Traitement de la catégorie : " + category)
|
||||
print("\n -> Traitement de la catégorie : " + category)
|
||||
|
||||
# check if multiple pages and create a URL list
|
||||
url_list = check_for_pages(category_url)
|
||||
@ -159,7 +162,7 @@ def main():
|
||||
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("Nombre de livres: ", len(product_url_list))
|
||||
print(len(product_url_list), " livres présents")
|
||||
processed_books += len(product_url_list)
|
||||
|
||||
# combine with phase 1 and write in csv for each url from product_url_list named with category
|
||||
@ -171,9 +174,12 @@ def main():
|
||||
# print(phase1.get_data(page_soup, page_url))
|
||||
data.append(get_data(page_soup, page_url))
|
||||
|
||||
print("Done.\n Fichier " + data_output(data, category))
|
||||
print("Nombre total de livres traités : ", processed_books)
|
||||
print("Livres restants à traiter : ", total_books - processed_books)
|
||||
print(processed_books, " livres traités")
|
||||
print(total_books - processed_books, " livres restants")
|
||||
print(total_category, " catégories restantes")
|
||||
print("Done.\n Fichier " + data_output(data, category))
|
||||
|
||||
|
||||
|
||||
|
||||
print("\n Traitement terminé.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user