I use this to scrape ANY social media in n8n for ridiculously cheap

Learn how to scrape Facebook Ads Library and other social media platforms using n8n's Scrape Creators node. The tutorial covers setting up credentials, searching for ads like "AI services", analyzing images with OpenAI, and saving results to Google Sheets, all for cheap.
Chapters
What's up guys, in this video we're going to be going over how to scrape literally any social media platform using this app called Scrape Creators. I know scraping social media platforms can be tricky sometimes depending on the social media platform you're trying to scrape and also the information that you're trying to get, but with this platform it allows you to just do it in the most simple way possible. So we're going to jump straight into it and I can show you around. So I've got a blank NAN, uh, workspace here. I'm just going to add a trigger manually just as the trigger. And then if we go to Add and then go to Scrape Creators, you can see it pops up here, Scrape Creators. And now it has this little tick here, which means it's a community-managed node, which basically just means if you haven't installed this already, if you type in the exact same thing up here, there will be an orange button that says Install Node, and you just hit that and install it, and it will now be installed onto your NAN instance so you're able to actually use it. So in here you can see these are all of the different actions. So it basically Uh, divides them up into the social media platforms and of course the actions inside of those. So if we have a quick look, you can do Facebook, Facebook Ads Library, Google Ads Library, Google Search, Instagram, LinkedIn, LinkedIn Ads, Pinterest, Reddit, Threads, uh, TikTok, Truth, Twitter or X, YouTube, and that's it. But obviously that's loads and you can see there's loads of actions inside of all of them. Altogether there is 59 different actions that you can do inside of these social media platforms. So for this one, we're going to be looking at Facebook and Facebook ads. So if we quickly do a search for Adsnode here, and I can show you also how to set up the credentials. By the way guys, just to interrupt, if you're really serious about NAN and you want to actually master it and learn how to implement it into a business, then the waitlist for my community where you can learn exactly how to do this is live in my bio. So if you want to sign up for it, you can get an early bird discount and you also get notified as soon as it drops. I've already set up my credentials, but if you want to set up new ones, you just go to create new credential, and then all you need is an API key. So if you come over to Scrape Creators, you can make a free account. It's completely free to make an account, and you'll be met with a screen that looks like this where it will show your available credits and then your API key. And now with the credits, if you go to billing, uh, this works a little bit differently from most platforms that you probably use. It's not like an ongoing monthly subscription. You basically just pay for the credits that you want to use. So you can see each API call costs around 1 to 2 credits, I found just from testing it out. Um, so you can buy 5,000 credits for $10, 25,000 for $47, 500,000 for just under $500, and then you can do a custom amount if you want more than that. So it's pretty affordable. It's actually pretty good pricing and you get, um, 100 for free. I've already used a couple of them, but you get 100 for free. Um, and yeah, all you have to do is just set up a free account, you get 100 for free, and then you get your API key. So you go to copy and then you just come back over to N8N and you just paste that into there and then hit save. And then you'll see it says connection tested successfully. And now you're all set up. That's all you have to do. So inside of the node here, you can see the resource, which is just going to be all of the different social media platforms. So this is actually a nicer way of viewing it. You can see all the different social media platforms that you can integrate with, and then inside of those, you can see the actions that you can do inside of those platforms. So for this one, we've done Facebook ads, and we can either get a specific ad, search for ads, get a specific company's ads, or search for a company. So we're just going to do search for ads, and we're just going to do it as if we want to start running, um, Facebook ads for AI services. Let's just say we're going to be able to scrape all of the ads inside of the Facebook ads library, and then we're also going to go a little bit deeper and scrape some of the Facebook pages that are running these ads. So for the query, we can just type in any query we want here. So we're just going to say AI services, keeping it pretty broad. And then the limit, right now it's at 50. Just to test this out, we're just going to set it to 10 just so you can see how it works. We hit execute set. It doesn't take long at all, which is pretty nice. It only takes a couple seconds usually. You Yeah, so you can see we get this data back. So let's switch it to schema and you can see this is the information we get. So the ad archive ID, the end date, and then is it active, the page name, and then a snapshot of the ad. So the page ID, page is deleted, uh, page profile URL, uh, the page name, the page picture URL, and then the caption of the ad, the CTA, the body text of the ad, the display format, so it's a video, the link URL, the categories, the page like count, and then it gives us the actual video as well. So it won't let us copy this. So if we switch to table view and then we'll be able to see the whole thing. So video URL, if we copy this, we'll be able to actually see the video, which is cool. Okay, so this is the video. Just something to mention as well, obviously that wasn't in English. I would be wanting them in English. Down here, if you go to Add Field, you can add more options. So you can do things like ad type. So it could be all, or it could be political and issue ads. They're the only, um, ad types you can search for inside of Facebook Ads Library. Or you could do the country, the end date, the search type, uh, you could do the start date, the status, everything like that. So what we're going to do, so we'll quickly change the country and we'll just leave it on US. And if we execute step again, now we get some US ones. So wait for it to come through, and then we'll check one of the videos. Uh, okay, so this one was an image actually. Let's look at the image. Uh, copy this, open it here. Okay, this was the image that we got. Pretty cool. And of course we get that, we get 10 different items. Uh, it all comes for us one item, which is, um, depending on how you look at it, could be a positive, could be a negative. But of course it doesn't really matter because we can do things like split out and aggregate to change that. But yeah, it comes through like this. There's one item and then search results, and then search results 0, 1, 2, 3, so on and so forth. So what we can do first of all is we can just split out this data. So if we add another node after, go to split out, and then drag in the fields to split out. We're just going to drag in the search results. And if we execute step, you can see now we've got 10 items, and these are all of the different ads. So we've got 10 ads and now split out into 10 items, and each item is just going to be the individual ad, which is pretty cool. So we're going to get some more data through here. We set it to 10, we're just going to set it to 30, and then let's run this entire system through. So that's going to give us 30, and then it will split out— or do it as one item, and then it's going to split out into 30 items. So we can work with 30 items, um, individually. We can work with each ad individually. So perfect, you can see here this is what we've got. And then let's say we want to sort it depending on whether it's a video or an image. So let's go to, uh, switch. What we can do to sort by the type is we can just grab one of these video variables like video_hdl_url, and then we can just drag that in. And then we can say string exists. If it exists, it goes one way. If it doesn't, it goes the other way. So if we do this again and then go to doesn't exist, does not exist. Okay, then you can see now I've hit execute step, it's split it up. So the first one got 17 items, the second one was 13 items. What we'll do is we'll quickly rename these. So the first one, if this exists, it means it's a video ad, and then this one means it's an image ad. So then if we execute this again, you can see we've got 17 in video and then we've got 13 in image. So this Very, very cool. And then what we can do after that is we can start to analyze the, uh, information in these ads. So the actual ads themselves. So if we start with image, we're going to do a loop over items. So we're going to loop over— there's 13 that's come through. We're going to loop over each of them individually. So set the batch size to 1, get rid of all of this stuff here, and then we can go OpenAI, and then we can analyze image. Okay, cool. So if we quickly execute this node here to get some information through, then we can get the URLs from their ads. So I've dragged in the image URL, as you can see here. So images and then original image URL. And then for the text input, we're just going to say what's in this image. But something important to note here is if you just drag in the URLs from, uh, the output we get here, so something like original image URL, and drag that into the input here, you're probably going to get an error because these aren't reliable links that OpenAI are able to download and then view the binary data of. So what you need to do first, you need to get the binary data from here. And this is a cool little hack that you can do with NAN if you didn't know. If you add a HTTP node and then you just do a simple GET request and you just put in any image URL— so we can drag in this one, or we can drag in this one— and then if you hit execute step, it will actually give you the binary data, which is really, really cool. So as you can see, binary data. If we hit View, it will show us a preview of what that binary data is, which is cool. And then we can come over to the Analyze Image node here, and then we can just set this from the input type from image URLs to binary files. And then the input data name is just data. So then we can hit Execute Step, and now you'll see actually works and it can actually give us an output. So that's very, very cool. What we can do now after this— now we've got the, um, analysis of the image— we can add all of this to a Google Sheet. So if we go to Google Sheets. And then let's do append row in a sheet. And then I started building this Google Sheet, and I think we can add a little bit more data to this. We've got page name, page ID, page URL. Let's see what information we're actually able to use. So we get all of this. So we could do— we've got page name, we've got page ID, and then we can do the text of the image. So let's say— or the ad, sorry. So let's say ad text. And then how about we just do image URL, and then image description. Okay, cool. Let's name this quickly. Let's call this Add Analysis. And then if we come back over and we just hook up this new sheet— so Add Analysis. I know I spelled analysis wrong, uh, that's gonna annoy me. Actually, I'll change it. Cool. And then, uh, sheet number 1. Very cool. Let's make sure that this is actually on the right one. Yep. You can see here, this is pretty interesting as well because the Loop Over Items node, it says no fields because the data we're trying to get isn't directly after it. So from here you can see this node is directly after the Loop Over Items node, so we can get data from it. But then anything other than that, this is something that's kind of annoying with N8N actually. Um, you can see we can't get any data from. So simple fix. All we do is we go to Edit Fields. Straight after, and we just drag in here the variables that we want to keep. So page name we wanted to keep, page ID we wanted to keep, and then the text we wanted to keep, and then the image URL we wanted to keep, and then also just the URL. Okay, yeah, the profile URL. Perfect. Now if we execute this and then we run this through again, you'll see now we actually have access to those variables. So yeah, this is something that will probably happen often to you, um, it's a little bit annoying But it's a pretty simple fix if you just add the edit fields after and then it will all be there. So this has gone through. If we look at edit fields, you can see now we get the data that we actually want. So page name, drag that in. Page ID, page URL was at the bottom, so we grab that. And then the add text, we can just drag that in. And then the image URL, we can drag that in. And then the image description, we of course get from this step before. If we hit execute step now, It's going to run these through again, then you'll see in the Google Sheet we should have some data in there. Okay, cool, that's a run through. And then in our spreadsheet we have this, we've got a page name, a page ID, a page URL, cool. And then the ad text, the image URL here, and then the image description. So very, very cool, we can now run this through. I'm not going to run it through for all 13 of them, but you get the idea of how this now works. What we can do is we can now just pretty much copy this and drag it over to the video side. So loop over items again, and then this time we're still gonna need the edit fields, but we're not gonna need the HTTP request or the analyze image because of course there is no image. And we're also gonna need to adjust the variables in the edit fields 'cause we no longer have the image URL. This time it's gonna be a video. So if we execute this one quickly so we get some data through, and then you can see the image URL of course doesn't work, so we can delete that. And what we can drag in instead should be the video URL. Yeah, so video HD URL, we can just drag that in. Perfect. Here, execute step. And now we get that data through. And now let's go over here, let's make this the, um, image one. So let's say image, cool. And then let's add another one, rename, and we'll call this video. And then if we just nick the, uh, headers from here put them into here, and of course change the image URL for video URL. Video. Cool. Come back over, and then now you can see if we simply just execute that— need to change the sheet of course. So if we go to video, you can also get rid of the image description column as well. Cool. And then we just change over the variables that are in here, so we just drag in the new ones. Uh, image description shouldn't be there anymore. And then if we come back over, you can see now this is what we've got. So we've got the page name, we've got the page ID, the page URL, the ad text, and then the video URL here. And let's see if we can actually view the video this time. Automatically selecting the right AI services from— Okay, cool. So that was the video. Um, yeah, perfect. There we go. So now you can do further analysis on this. You could go in a little bit deeper and you could, um, look through each Facebook page as well. Pretty simply, all you'd have to do is go to, uh, Scrape Creators again, Scrape Creators, and then it would just be Facebook, get a Facebook profile, and then you already have their profile URL. So you could just drag that in there and then you can get information on their Facebook page and you can just add that all to the Google Sheet. But yeah, uh, I could make this video 10 hours long to show you all of the use cases of this because of course it's searching anything through social media, but I just thought this was a really, really great app that allows you to, in the most simple way possible— so simple, so convenient— just scrape any social media platform.
More from Rory

Dynamic Workflows are crazy. This is how to actually use them (beginner's guide)










