How would you get prices from hotel websites

#1

On Fundamentals II, you show us how to compare prices and evaluations.

Is there any commands to fetch prices from different websites?

Our family is comparing different travel packages
on different travel agencies, and it’s quite a time consuming issue.
So, I’m asking if there’s any commands like
Import.prices (www.travelagensy1.com), or something?

#2

It is possible to do that, but the app currently doesn’t support it.

Different websites have different ways of organizing and giving access to their data. The way you get another website’s data is through an API. Not every website will offer an API, but if they do, you usually do a simple sign up to get a password (API key) that you combine with a special URL that leads to a page with some JavaScript code or objects (JSON).

You can find more information here.

–Frankie

1 Like
#3

Thank you Frankie so much for this response.
It was an eye-opening reading to get.

So, you say that the password is the API key. I didn’t know that. :grinning:
And these websites are in Finnish, so it’s of no use to share them to you. Besides to admire them.

And my idea was that I would make an app to use for myself, and see if I can do a simple but an effective system. Not that anything about coding is simple to use…?!

So, if I get or have a password to these websites, how do I make the special URL?

#4

Each website will have their own instructions, and some may not offer an API at all.

The API key is different from a regular username/password on the website. It will be a jumble of letters and numbers given to you after going through the signup process for each individual site. You’ll have to search the website for instructions on how to access their API, sometimes it’s easiest to just Google search the website + “API”.

–Frankie

#5

Hey Frankie,

I have been looking forward to hearing from you all day. So thank you for this message.

I think I get what you are saying in this last message. And googling for website + API sounds like a good plan.

Did I misunderstand your message from yesterday?
Do you mean in this quotation that I will get the special URL from that website?
And does that special URL hold the JSON?

“…you usually do a simple sign up to get a password (API key) that you combine with a special URL that leads to a page with some JavaScript code or objects (JSON).”

Or where do I get the JSON?

And to take the next step in this hypothetical matter, here’s what I think that I need to do.
I’ll put those codes to a compiler program and make the application? Or on a website under my domain?

#6

The URL will lead to the JSON, but you’ll only be able to access it if you have a valid API key. You can start making the code on your own computer, and once it seems to be working you can upload it to your own website. Be aware that if you get an API key, it will likely have a limit on the number of times you can use it per day. This is so that your program doesn’t request data from the server millions of times nonstop. If you end up publishing your code somewhere public, you’ll might want to be protective of the key.

To start working with code outside of Grasshopper, you can try making a snippet. I wrote a bit about how to do this in another thread:

Good luck!

–Frankie

1 Like
#7

Okay, this sounds like a ready version of my “attack plan”.
But I need to emphasize that I’m doing these things only on my smartphone.
I can cope with computers, but I very much prefer doing these with my phone.
I don’t like working with computers.

Here’s the plan
Google for the website + API key,
Register to that travel agency website,
Pick up the price check code from the Grasshopper practice session,
Plant it on my own website or a compiler application.
Start wondering that what went wrong…

Yeah, sounds like a good plan