Scraping Facebook Events
If you need to scrape events from Facebook, we’ll walk through how to legally do this (without violating the Facebook Terms of Service) by simply browsing through the events you’d like to scrape on Facebook while recording your web traffic.
And since this method is 100% undetectable, it’s safe to use while logged in to your Facebook account, but you can also scrape events while logged out as well since this data is available publicly.
Below we’ll walk through a simple example for how to scrape all of the events in a specific city like Miami. However, the overall approach will work for any search result page of Facebook events, so you can go worldwide for example but instead search for a specific type of event.
1. Find an Event in the Target City
Head to the Facebook Events Search page and start by searching for the city you want to scrape the events in. For this example, we’ll use Miami – just type that into the search and usually the first results will contain an event matching your city. If not, just try some of the other top results until you see an event in your target city.
2. Record Network Traffic
Once you’re on an event page in your target city (make sure you see the badge in the below screenshot under event details), you want to refresh the webpage (to reset any dynamic data Facebook has already loaded into your browser) and once the page is reloaded, right click somewhere and hit “Inspect” to open developer tools, which will begin recording your web traffic.
2. Click the Target City Badge
Now that your browser is recording, we want to navigate to the city page so Facebook will load all of the events in that city. Simply click on the city badge as shown below, and Facebook will dynamically load the events into your browser.
The reason we need to do it this way instead of going to the page directly is that if you go to the page directly, Facebook will send the first set of results as HTML (which we can’t scrape). However, if we load the page dynamically we can scrape the first set of events. If you don’t care about the first set of events, you can ignore this step.
3. Browse Facebook Events
Once the events are loaded, you can verify they are loading into your browser under the “Network” tab in developer tools. Under the filter you can type in graphql
to see the Facebook API requests Facebook is making to load in the events.
Now you can scroll down through all of the events to force Facebook to keep sending more and more data to your browser as you’re recording it. Keep scrolling until you get through enough or if Facebook stops sending over data.
4. Export a HAR File
Once you’re done scrolling, go to the “Network” tab under developer tools and click the down arrow labeled “Export HAR…” to export a HAR file containing the raw Facebook data we just browsed through. Then upload that file to the HAR File Web Scraper to extract out the data.
Look for the group as shown above, where the title ends in graphql
and you see fields similar to the ones shown above. It should be the first group on the page, but if not you may need to scroll down and look for it. Click “Parse Group” to combined the results together on the next page, or you can look for the blue downloadable links to download the raw JSON data 100% for free with our tool.
5. Download Facebook Events
Once the parse finishes, look for the collection labeled data › viewer › suggested_events › events › edges
which will contain the events in CSV format. Click “Download CSV” to download this data and you can import it into Excel or your program of choice.
You’ll see basic information about each event, with some of the more interesting columns outlined below:
- Event ID (Use this for de-duplication if needed)
- Event Name
- Online Event?
- Facebook Event URL
- Event Type (Public / Private)
- Start Datetime
- Cover Photo Image URL
- Attendance Metrics (Number Interested & Going)
- Price Range
- Venue Facebook Place ID
- Venue Place Type (Facebook Page or Freeform)
- Venue Name
- Venue City
- Online Ticket Sales URL