This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| city_from = input('From which city? ') | |
| city_to = input('Where to? ') | |
| date_start = input('Search around which departure date? Please use YYYY-MM-DD format only ') | |
| date_end = input('Return when? Please use YYYY-MM-DD format only ') | |
| # city_from = 'LIS' | |
| # city_to = 'SIN' | |
| # date_start = '2019-08-21' | |
| # date_end = '2019-09-07' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def page_scrape(): | |
| """This function takes care of the scraping part""" | |
| xp_sections = '//*[@class="section duration"]' | |
| sections = driver.find_elements_by_xpath(xp_sections) | |
| sections_list = [value.text for value in sections] | |
| section_a_list = sections_list[::2] # This is to separate the two flights | |
| section_b_list = sections_list[1::2] # This is to separate the two flights | |
| # if you run into a reCaptcha, you might want to do something about it |