Actualiser main.py
This commit is contained in:
parent
0f28ef11c9
commit
2b01ab1af8
30
main.py
30
main.py
|
@ -4,10 +4,15 @@ import le_fooding_scraping
|
||||||
import petit_fute_scraping_v2
|
import petit_fute_scraping_v2
|
||||||
import resto_de_paris_scraping
|
import resto_de_paris_scraping
|
||||||
import google_scraping
|
import google_scraping
|
||||||
|
|
||||||
|
import datetime
|
||||||
from icecream import ic
|
from icecream import ic
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Choose desired path to export scraped data
|
||||||
|
desired_path = '/Users/oliviermeyer/Desktop/'
|
||||||
|
|
||||||
# Initial scraping
|
# Initial scraping
|
||||||
df1 = best_restaurants_scraping_v2.complete_scraping()
|
df1 = best_restaurants_scraping_v2.complete_scraping()
|
||||||
# df2 = gault_et_millau_scraping_v2.complete_scraping()
|
# df2 = gault_et_millau_scraping_v2.complete_scraping()
|
||||||
|
@ -19,14 +24,23 @@ def main():
|
||||||
df3_2 = google_scraping.google_scrap_fooding(df3_1)
|
df3_2 = google_scraping.google_scrap_fooding(df3_1)
|
||||||
df4_2 = google_scraping.google_scrap_fute(df4_1)
|
df4_2 = google_scraping.google_scrap_fute(df4_1)
|
||||||
|
|
||||||
|
# Get today's date in string
|
||||||
|
date = str(datetime.date.today())
|
||||||
|
|
||||||
# Export all the dataframes
|
# Export all the dataframes
|
||||||
df1.to_csv('/Users/oliviermeyer/Desktop/best_restaurants_test.csv', index=False, header=True, escapechar='\\')
|
df1.to_csv(desired_path + 'best_restaurants_' + date + '.csv', index=False, header=True, escapechar='\\')
|
||||||
# df2.to_csv('/Users/oliviermeyer/Desktop/gault_et_millau_test.csv', index=False, header=True, escapechar='\\')
|
# df2.to_csv(desired_path + 'gault_et_millau_' + date + '.csv', index=False, header=True, escapechar='\\')
|
||||||
df3_2.to_csv('/Users/oliviermeyer/Desktop/le_fooding_test_3.csv', index=False, header=True, escapechar='\\')
|
df3_2.to_csv(desired_path + 'le_fooding_' + date + '.csv', index=False, header=True, escapechar='\\')
|
||||||
df4_2.to_csv('/Users/oliviermeyer/Desktop/petit_fute_test_2.csv', index=False, header=True, escapechar='\\')
|
df4_2.to_csv(desired_path + 'petit_fute_' + date + '.csv', index=False, header=True, escapechar='\\')
|
||||||
df5.to_csv('/Users/oliviermeyer/Desktop/resto_de_paris_test.csv', index=False, header=True, escapechar='\\')
|
df5.to_csv(desired_path + 'resto_de_paris_' + date + '.csv', index=False, header=True, escapechar='\\')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
# List of days that have been processed
|
||||||
ic()
|
done_dates = []
|
||||||
main()
|
|
||||||
|
# Call the main function every new day
|
||||||
|
while True:
|
||||||
|
today = datetime.date.today()
|
||||||
|
if today not in done_dates:
|
||||||
|
ic()
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user