m-wrzr / populartimes

MIT License
837 stars 168 forks source link

Possibility to get current popular time #2

Closed jankuss closed 7 years ago

jankuss commented 7 years ago

I'm using your library for getting the average popular times, but is it possible to get the current popular time of the place?

current

I tried to reverse engineer the response of google but didn't find a way to retrieve the current popular time.

m-wrzr commented 7 years ago

Hey,

the URL where we get the data from and its JSON response has no current popular times data available. Looking at the network traffic, there is a www.google.de/maps/preview/entity request, which contains the current popularity. However, it seems to require a protocol buffer parameter.

It could be possible to retrieve the current popular times this way. We will look into that.

irux commented 7 years ago

I am really interested in this feature too. It would be great if you give some advice to get the data and implement it.

zachary-m commented 7 years ago

Any updates?

m-wrzr commented 7 years ago

Check out https://github.com/m-wrzr/populartimes/tree/current_popularity. It should work so far, but I would like to test it more before it get's merged into master.

zachary-m commented 7 years ago

How could I use this with a placeID? I already have a location and I want the info on the specific location?

i get the error "AttributeError: module 'populartimes' has no attribute 'get_current'"

strange.


I even saved the correct files in my home folder....

m-wrzr commented 7 years ago

To find a specific place/google id you can use the scraper or this: https://developers.google.com/maps/documentation/javascript/examples/places-placeid-finder.

Did you switch to the correct branch and removed the previously installed package? It works find for me.

zachary-m commented 7 years ago

Is there any way to use python to scrape the location ID given the address?

On Oct 7, 2017 4:59 AM, "m-wrzr" notifications@github.com wrote:

To find a specific place/google id you can use the scraper or this: https://developers.google.com/maps/documentation/javascript/ examples/places-placeid-finder.

Did you switch to the correct branch and removed the previously installed package? It works find for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/m-wrzr/populartimes/issues/2#issuecomment-334921153, or mute the thread https://github.com/notifications/unsubscribe-auth/AF_9nOLqWY8-JQx1C8fLvX2VeFAx5tFwks5spz1xgaJpZM4O4J2K .

m-wrzr commented 7 years ago

You should be able to use https://developers.google.com/places/web-service/search?hl=en#TextSearchRequests if you want to use a specific address

deeznuts03 commented 7 years ago

would it be possible to:

1) make get_current() have geofence parameters just like get(), to output current popularity for all places inside the fence?

2) add the logic for get_current() to the innards of get(), so that get() will return all data it already does plus "current_popularity: xx"?

Those would make certain processes much faster!

deeznuts03 commented 7 years ago

And can you please share how to export this data into a readable format? I just get it all as one giant string. CSV and/or excel export would be ideal, but even a better format in python IDLE is good for now.

m-wrzr commented 7 years ago

Hey @deeznuts03 The current popularity is now available via the normal populartimes.get(). #6

I don't think it is necessary to add geofence parameters to get_current(), as there are now already two ways how to retrieve the data for an area. Either with get() or if you wan't faster requests just save the place-ids in this location and call get_current().

The library is supposed to be a lightweight and easy option for people to retrieve the data and then work with it. By keeping to the python types and returning the data as a dict, this is guaranteed most IMO.

m-wrzr commented 7 years ago

Current popularity is now available #6

deeznuts03 commented 7 years ago

Hey @m-wrzr thanks a ton! Looks like there are some awesome updates! I'm pretty new to python, so I'm a bit slow on understanding how all of this works and how to leverage your updates. I think you have helped me greatly though, and I am very thankful for the efforts.

jkldgoefgkljefogeg commented 7 years ago

What is the unit/range of current_popularity? Is the number comparable between building of different sizes (stadium with 50 people vs restaurant with 50 people, the restaurant is likely to be far more crowded)?