Facebook Ads Library scraper

I’m trying to automatically download some facebook ads so I can use them as reference when creating new ads.

But using the official API only gets me some basic data.
So I’m trying to build one with n8n to get some specific data.

The problem is the classes are random!

How can I extract the data when class names change every time?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @solomon

Yeah, Facebook does a pretty good job at obfuscating their content to avoid bot scrapers. I would probably just experiment a bit, try getting all divs and see if you can detect a pattern (e.g. are the ads always the last 3 at the bottom?) and then filter those out (will need consecutive nodes).
Or perhaps you can find some unique ID that you can reference to (as IDs will not be changed).

I know that one of our community members @oskar is an expert in Web Scraping with n8n. You should check out his YouTube tutorials for some inspiration! :slight_smile:

1 Like

Thank you, @ria .
I ended up using an external paid tool.

But I’d love to use only n8n for this.
Maybe @oskar has the answer, then.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.