Actualiser resto_de_paris_scraping.py

This commit is contained in:
Olivier MEYER 2024-06-27 11:42:32 +02:00
parent f1af9ff406
commit 0b1a467388

View File

@ -102,7 +102,6 @@ def get_menu(soup):
index_last_price = 0 index_last_price = 0
for i in range(len(prices_v2)): for i in range(len(prices_v2)):
ic(prices_v2[i])
if '' in prices_v2[i]: if '' in prices_v2[i]:
index_last_price = i+1 index_last_price = i+1
if index_last_price != 0: if index_last_price != 0:
@ -124,13 +123,13 @@ def complete_scraping():
for name, url in zip(names, restaurants_url): for name, url in zip(names, restaurants_url):
temporary_df = pd.DataFrame(columns=['Name', 'Date', 'Address', 'Item', 'Price', ]) temporary_df = pd.DataFrame(columns=['Name', 'Date', 'Address', 'Item', 'Price', ])
ic()
ic(name) ic(name)
page = requests.get(url) page = requests.get(url)
soup = BeautifulSoup(page.text, features='html.parser') soup = BeautifulSoup(page.text, features='html.parser')
temporary_df['Item'] = get_menu(soup).keys() temporary_df['Item'] = get_menu(soup).keys()
temporary_df['Price'] = get_menu(soup).values() temporary_df['Price'] = get_menu(soup).values()
address = get_address(soup) address = get_address(soup)
ic(address)
for i in range(len(temporary_df)): for i in range(len(temporary_df)):
temporary_df.loc[i, 'Name'] = name temporary_df.loc[i, 'Name'] = name