Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

num_flights #7

Open
whatevernevermindbro opened this issue May 15, 2023 · 3 comments
Open

num_flights #7

whatevernevermindbro opened this issue May 15, 2023 · 3 comments

Comments

@whatevernevermindbro
Copy link

Hi Kaya!
Version 1.1 looks great!

I want to suggest an option to parse a fixed number of flight options at once. Currently, the received number of flights is limited.

Here is an example, let's say we will take SFO - IST, from Aug 1 to Aug 17. If you search for it you can actually see that there are more than 120 flights in the case of a one-way ticket and more than 70 flights in the case of a round-trip, while the Scrape returns only 21 flights in total.

I am guessing that the current version of the scraper returns only the flights from the front page. In that case, I would suggest making it possible to push this "X more flights" button with Selenium in order to get the needed number of flights in the same window.

image

On the other hand, it might be not necessary to make it a number of flights against making it a useful set of filters like date/time of arrival, time of the flight, etc.

Hope that is interesting.
Have an amazing week!

@smyja
Copy link

smyja commented May 18, 2023

+1

@kevinsimard
Copy link

Any update on this? All flights are now queried correctly or still returns only the first 21 flights?

@haciMMicah
Copy link

If anyone is still interested in this, the class name of the div containing the button is ZVk93d which only contains a single button so finding the button element and clicking it is done pretty simply with something like

more_flights_div = driver.find_element(
    by=By.CLASS_NAME,
    value="ZVk93d",
)
more_flights_button = more_flights_div.find_element(
    by=By.CSS_SELECTOR, value="button"
)
more_flights_button.click()

From there, since you know how many elements to wait for you just need to wait for them. Then each flight's info is in another list item with class name pIav2d so you can just find all flight info elements after clicking the button via

driver.find_elements(by=By.CLASS_NAME, value="pIav2d")

It might take some changes to the parsing code but you probably can just drop this into _get_flight_elements and have it just work. since the .text items should be the same.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants