Skip to content

Scrape Facebook page events(recurring and upcoming), and individual event on new Facebook design

License

Notifications You must be signed in to change notification settings

jonmuell/facebook_events_scraper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

facebook_events_scraper

Install

pip install facebook_events_scraper

Usage

import facebook_events_scraper as fes
fes.driver(chromedriver)
fes.login(email, password)
fes.event_info(driver, link="")
fes.events_recurring(driver, link="")
fes.events_upcoming(driver, link="")
fes.events(driver, link="")

driver(pathToChromeDriver)

  • You can write your own selenium webdriver code, and also use other browser drivers
  • Or, you can use the package's driver function
  • To download Chromedriver: https://chromedriver.chromium.org/downloads
  • example: driver = facebook_events_scraper.driver("chromedriver")

login(email, password)

  • If you use the package's driver, you only needs to login once because it creates selenium folder which will save the Chrome cookies, the settings, extensions, etc, and the logins done in the previous session are present here.
  • Example: facebook_events_scraper.login("[email protected]", "mypassword") i

event_info(driver, link="")

  • Example: facebook_events_scraper.event_info(driver, "https://www.facebook.com/events/310254858646618")
  • The function returns one dictionary
return {
    "hosts": ["...", "...", ....],
    "title": "...",
    "time": "...",
    "description": "...",
    "location": "...",
    "ticket": "...",
    "link": "...",
    "image": "...",
    "interested": "...",
    "going": "...",
    "categories": ["...", "...", ....]
}

events_upcoming(driver, link="") and events_recurring(driver, link="")

  • Example: facebook_events_scraper.events_upcoming(driver, "https://www.facebook.com/pagename/events/")
  • Example: facebook_events_scraper.events_recurring(driver, "https://www.facebook.com/pagename/events/")
  • The function returns a list of dictionaries
return [
    {
        "hosts": ["...", "...", ....],
        "title": "...",
        "time": "...",
        "description": "...",
        "location": "...",
        "ticket": "...",
        "link": "...",
        "image": "...",
        "interested": "...",
        "going": "...",
        "categories": ["...", "...", ....]
    },
    {
        "hosts": ["...", ...],
        "title": "...",
        ...
        ...
        ...
    },
    ...
    ...
    ...
]

events(driver, link="")

  • Example: facebook_events_scraper.events(driver, "https://www.facebook.com/pagename/events/")
  • The function returns a list of dictionaries
return [events_upcoming(driver, link) + events_recurring(driver, link)]
  • Note: All the scraping function only works when the facebook layout is the same as when the browser is maximized

Preview

event_info event_recurring event_upcoming

About

Scrape Facebook page events(recurring and upcoming), and individual event on new Facebook design

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%