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():
|
def main():
|
||||||
# init
|
# init
|
||||||
url = "https://books.toscrape.com/"
|
url = "https://books.toscrape.com/"
|
||||||
category = "fantasy"
|
category = "default"
|
||||||
|
|
||||||
# get functional variables
|
# get functional variables
|
||||||
soup = get_html(url)
|
soup = get_html(url)
|
||||||
@ -64,14 +64,14 @@ def main():
|
|||||||
|
|
||||||
# check if multiple page and get url list
|
# check if multiple page and get url list
|
||||||
url_list = check_for_pages(category_url)
|
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
|
# get product list for each url_list, extend the main product url list with
|
||||||
product_url_list = []
|
product_url_list = []
|
||||||
for i in url_list:
|
for i in url_list:
|
||||||
product_url_list.extend(get_product_url_list(i, url))
|
product_url_list.extend(get_product_url_list(i, url))
|
||||||
# print("Liste des URL des produits: ", product_url_list)
|
# 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
|
||||||
@ -83,7 +83,8 @@ def main():
|
|||||||
# print(phase1.get_data(page_soup, page_url))
|
# print(phase1.get_data(page_soup, page_url))
|
||||||
data.append(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__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user