Skip to content
This repository has been archived by the owner on Dec 22, 2019. It is now read-only.

Events_by_location is pulling in events on incorrect dates #2

Open
nspilman opened this issue Jan 4, 2018 · 3 comments
Open

Events_by_location is pulling in events on incorrect dates #2

nspilman opened this issue Jan 4, 2018 · 3 comments
Assignees
Labels

Comments

@nspilman
Copy link

nspilman commented Jan 4, 2018

Thank you for the great application. I have found that the location based searches work, except instead if pulling in results for Today, I get results across the board.

For example, I'm looking for Music events in Madison, WI-

TODAY = time.strftime("%Y-%m-%d")
fulllist = facebook_bot.get_events_by_location(43.0730517, -89.4012302, place_type='*',
                           distance=1000, scan_radius=500, base_time=TODAY,
                           fields=EVENT_FIELDS, f=None)

for line in fulllist:
    try:
        if line[0]['category'] == 'EVENT_MUSIC':
            try:
                eventname = line[0]['name']
                eventid = line[0]['id']
                eventstart = line[0]['start_time']
                eventlocation = line[0]['place']['location']['street']
                eventid = {'name':eventname, 'starttime': eventstart, 'location': eventlocation}
                if eventid not in dicts:
                    dicts.append(eventid)
            except:
                print('uhhm')
    except:
        continue

for i in dicts:
    print(i)

My results are as follows. Notice I get ZERO results for today, but instead results for dates across the board.

{'name': 'Le Vent Du Nord', 'location': '800 Langdon St', 'starttime': **'2018-05-05**T20:00:00-0500'}
{'name': "University Opera's La Boheme", 'location': '800 Langdon St', 'starttime': **'2018-02-23**T19:30:00-0600'}
{'name': 'Jack and Kitty: Vaudeville Jug Band Folk', 'location': '201 State St', 'starttime': '**2018-08-07**T19:00:00-0500'}
{'name': 'Propaganda Concert', 'location': '365 E Campus Mall, Ste 200', 'starttime': '2018-03-03T19:00:00-0600'}
{'name': 'Dirty Walter & The Fellas LIVE at SconnieBar', 'location': '1421 Regent Street', 'starttime': '2018-02-17T21:00:00-0600'}
{'name': 'Madtown Undergound Summer Kickoff!', 'location': '1206 Regent Street', 'starttime': '2018-06-02T19:00:00-0500'}
{'name': 'The Lacs - Dirt Rock Tour - The Annex, Madison, WI', 'location': '1206 Regent Street', 'starttime': '2018-04-15T18:00:00-0500'}

Thank you,
Nate

@tudoanh
Copy link
Owner

tudoanh commented Jan 9, 2018

Yes, because it's the base time, which mean it'll crawl all the events start from today and not limited by any date at all.

You can fix that by adding until query param in this line:
https://github.com/tudoanh/python-facebook-bot/blob/master/facebook_bot/facebook_bot.py#L133

I'll update soon to add the stop date point when filter. You can check the Facebook official docs here for more infomation.
https://developers.facebook.com/docs/graph-api/using-graph-api#time

Thanks for using my lib. Hope you guys will continue report more bugs so I can improve it.
P/s: Please using the ``` for code syntax. Like this:

import string
print(string.ascii_letters)

@tudoanh tudoanh self-assigned this Jan 9, 2018
@tudoanh tudoanh added the bug label Jan 9, 2018
@nspilman
Copy link
Author

Thank you for your response!

In regards to the fix you suggest above - my version of the API already has said code in the getevents() function.

events = s.get( BASE_URL + API_VERSION, params={ "ids": page_id, "fields": ( "events.fields({0}).since({1})" .format(','.join(fields), base_time) ), "access_token": token, } ) return events.json()

@tudoanh
Copy link
Owner

tudoanh commented Jan 19, 2018

Yes, I mean you could monkey patching my lib until I fix it :D

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

No branches or pull requests

2 participants