How do I scrape data from a web page? Facebook wants you to stay on its platform forever. They disallow sending a message to all your friends, so you need to get crafty to escape.

How Do I Do It?

If you’re using Google Chrome, it’s straightforward. There are many ways to scrape a web page, but I’m explaining a quick and dirty solution. If you want to escape Facebook, welcome to the club! Try the same method on any web page where you need obfuscated data on a web page.

  1. Navigate to: https://www.facebook.com/friends/list
  2. Alternatively, open Facebook and click the Friends tab.
  3. Scroll slowly until every friend is listed on the page.
  4. Open the vertical menu at the top right of Google Chrome.
    1. Alternatively, press Cmd-Option-i on macOS, and skip the next two steps.
  5. Choose More Tools
  6. Choose Developer Tools

Once this is complete, you should have a developer console open.

Paste this code into your console.

const result = $x('/html/body/div[1]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[1]/div/div[3]/div[1]/div[2]/div/div[*]/a/@href')
result.map(x => {console.log(x); })

This should log all of your Facebook friend profile page URLs. Now you can save the log and use the data to populate a CSV file and import it into LoopMessage or another tool that automates sending messages.

  1. Right-click the result line and click Save as…!
How Do I Scrape Data From A Web Page Console

You’ve scraped a web page, and now you can make your Facebook exit!

I wish you luck escaping the clutches of Failbook; you’ll need it!

By the way, Fuck Facebook.

References