Can yt-dlp Download Facebook Ad Library Videos?

Yes, yt-dlp can download Facebook Ad Library videos in most cases: recent versions ship a Facebook ads extractor that understands links like facebook.com/ads/library/?id=... and pulls the ad's video file. If it fails, update yt-dlp before anything else, because Meta changes its pages often and the extractor tends to get fixed after a break, not before.
I use yt-dlp for quick one-off grabs when I already have a terminal open. Below is how to set it up, the handful of commands that matter, and the places where it stops being the right tool.
What is yt-dlp?
yt-dlp is a free, open-source command-line program for downloading video and audio from websites. It started as a fork of the older youtube-dl project and has become the more actively maintained of the two.
It works through "extractors", small site-specific modules that know how to find the real media file behind a page. YouTube has one, Vimeo has one, and Facebook has several, including one aimed at Ad Library links. You give yt-dlp a URL, it picks the matching extractor, finds the available formats and saves the file.
There is no window, no buttons and no account. You type a command, it prints progress, and the file lands in the folder you ran it from. For marketers who are comfortable in a terminal that is a feature. For everyone else it is a hurdle, which matters later in this post.
Does yt-dlp handle Facebook Ad Library links?
In my experience, yes, for video ads. When you paste an Ad Library link that contains an ad ID, recent yt-dlp builds recognise it and fetch the video behind that ad.
A few things to know before you rely on it:
- You need the ad's own link. The useful URL looks like
https://www.facebook.com/ads/library/?id=1234567890. A search results URL (withq=and filters) is not the same thing and will not give you one clean ad. - Older installs may not have the extractor. If you installed yt-dlp a year ago and never updated, it may treat the link as unsupported.
- Meta changes the page. The Ad Library is a large JavaScript app, and when Meta reshapes how it loads data, extractors can break until a maintainer patches them. That is normal for any scraper, not a flaw unique to yt-dlp.
How do I install yt-dlp?
Pick the route that matches how you already install software.
With pip (any OS with Python 3):
python3 -m pip install -U yt-dlp
With Homebrew on a Mac:
brew install yt-dlp
Windows users can install with pip too, or download the standalone executable from the project's GitHub releases page. The project README lists the current options, so check it rather than trusting an old tutorial.
Then install ffmpeg. It is a separate free program, and yt-dlp uses it to merge video and audio when a site serves them as separate streams. On a Mac that is brew install ffmpeg. Without it you can still download, but you may end up with a silent video and a separate audio file, or a lower-quality combined format.
To update later:
python3 -m pip install -U yt-dlp # pip installs
brew upgrade yt-dlp # Homebrew installs
yt-dlp -U # standalone executable
How do I download a Facebook ad with yt-dlp?
The basic command is one line. Wrap the URL in quotes, because the ? and & characters confuse most shells.
yt-dlp "https://www.facebook.com/ads/library/?id=1234567890"
By default yt-dlp chooses the best available video and audio, merges them with ffmpeg and saves an MP4 (or whatever container fits) in your current folder.
How do I see which qualities are available?
Use -F to list formats without downloading:
yt-dlp -F "https://www.facebook.com/ads/library/?id=1234567890"
You will usually see a short table: an SD and an HD version, sometimes separate video-only and audio-only streams. Each row has a format ID on the left. To pick specific ones, pass them with -f, joining a video ID and an audio ID with a plus sign:
yt-dlp -f "VIDEO_ID+AUDIO_ID" "https://www.facebook.com/ads/library/?id=1234567890"
Swap in the IDs from your own -F output. In practice I rarely need this, since the default already grabs the best pair, but it helps when you want a smaller file for a deck.
How do I name files so I can find them later?
yt-dlp has an output template flag, -o. A simple version that keeps the ID in the filename:
yt-dlp -o "%(id)s.%(ext)s" "https://www.facebook.com/ads/library/?id=1234567890"
Which metadata fields are filled in depends on what the extractor finds, so run yt-dlp -j "<url>" once to see the JSON it returns and build your template from the fields that are actually there.
Can yt-dlp download more than one ad at a time?
Not out of the box in the way a media buyer means it. yt-dlp downloads the URLs you give it. It does not open an advertiser's page in the Ad Library, scroll through every running ad and collect them.
What you can do is feed it a list. Put one Ad Library link per line in a text file, then:
yt-dlp -a ads.txt
That works, but someone still has to collect those links by hand or with a script. If you want to automate the collecting part, you are now building a scraper, which is a bigger project. We cover that route in downloading the Meta Ad Library with Python and in our overview of the Facebook Ad Library scraper options.
Where does yt-dlp fall short for ad research?
yt-dlp is excellent at its job, which is getting a video file from a URL. Ad research needs a bit more than that.
Image and carousel ads. yt-dlp is built for video and audio. A static image ad will usually return an error or nothing useful, and carousel cards that are images will not come through as a set. If half your competitor's ads are statics, you need another method for those.
No swipe board or spreadsheet. You get a folder of video files. The primary text, headline, CTA, start date and landing page are not saved next to them in a readable form unless you write extra code to pull them from the JSON and store them.
One ad at a time. As covered above, batch mode only works if you already have the links.
It breaks when Meta changes things. The fix is usually yt-dlp -U and waiting a few days for a patched release. That is fine for a hobby workflow, and annoying when a client deck is due tomorrow.
Terms and rules. Downloading public ads for competitive research is standard practice across the industry, and the Ad Library is public transparency data. Meta's terms still restrict automated collection, so heavy scripted scraping carries more risk than saving a few ads by hand. Study the angle, do not reuse the creative commercially. This is general guidance, not legal advice; our post on whether downloading Facebook ads is legal goes into more detail.
What if yt-dlp says the URL is unsupported or fails?
Work through these in order:
- Update yt-dlp. Most failures on Facebook links are fixed by the latest release.
- Check the URL. Make sure it contains
?id=and a numeric ad ID, not a search query. - Run with
-v. Verbose output shows which extractor ran and where it failed, which is what you paste into a GitHub issue if you report it. - Check the ad is still live. Outside the EU, an ad drops out of the Library when the advertiser stops it, and there may be nothing left to fetch. Our post on why ads disappear from the Ad Library explains the rules.
- Try a manual method. The browser's network panel can expose the MP4 directly. We walk through that in downloading ads with DevTools.
When is a browser extension easier than yt-dlp?
Most of the time, if you are not the only person doing the work.
yt-dlp makes sense when you are technical, need one or two specific videos, and like having everything scriptable. It is also handy on a server, or when you want to plug downloads into an existing pipeline.
An extension makes more sense when you want to browse the Ad Library normally and save what you see, when teammates do not use a terminal, or when you need every ad from an advertiser including images and carousels.
How I do this day to day: I keep yt-dlp around for edge cases, but for actual competitor sweeps I use our free extension, the Meta Ad Library Downloader. It adds a Download button to each ad in the Library, saves videos in original HD plus images and full carousels, and its "Find all ads" mode collects every running ad in a search into one ZIP. That ZIP comes with a searchable swipe board and a CSV of every ad, which is the part yt-dlp does not try to do.
There are other routes too. If you cannot install extensions at all, see downloading from the Meta Ad Library without an extension. For the full comparison of methods, start with our main guide to downloading Facebook Ad Library videos.
FAQ
Does yt-dlp support Facebook Ad Library links?
Recent versions include a Facebook ads extractor that handles links in the form facebook.com/ads/library/?id= followed by the ad ID. Older installs may not recognise them, so update before testing.
Why does yt-dlp fail on an Ad Library link?
The most common causes are an outdated yt-dlp, a search URL instead of a single-ad URL, or a change on Meta's side that the extractor has not caught up with yet. Update, check the link contains an ad ID, and run with -v to see where it breaks.
Do I need ffmpeg to download Facebook ads with yt-dlp?
It is strongly recommended. Facebook often serves video and audio as separate streams, and yt-dlp needs ffmpeg to merge them into one file at the best quality.
Can yt-dlp download every ad from an advertiser?
Not by itself. It downloads the URLs you give it, so you can pass a text file of Ad Library links with -a, but collecting those links requires manual work, a separate script or a tool that works inside the Ad Library.
Is it legal to download Facebook Ad Library videos with yt-dlp?
Saving public ads for competitive research is common industry practice, but Meta's terms restrict automated collection, and reusing another brand's creative commercially is a different matter. Use downloads for study only. This is not legal advice.
The Klipio extension adds a download button to every ad in the Meta Ad Library: one click per ad, or bulk-save a whole search as a ZIP with a searchable swipe file inside. Free, no sign-up.
Get the free Ad Library downloaderKlipio reads a competitor's live Meta ads, ranks them by how long they have been running — the honest signal that an ad is profitable — and turns the winning angle into on-brand creative for your own brand. 3-day free trial.
Start free — 3-day trial →

