When you download an archive of your Facebook account, Facebook includes photos and videos you've uploaded, but not photos and videos you're tagged in that were uploaded by other people. This is a script to automatically download those.
This requires Python 3.
- Make sure you have
curl
(Linux and Mac likely already have it) mkdir photos videos
in the same directory as the scriptpip3 install selenium
- Download the ChromeDriver executable and put it somewhere in your PATH
- Set
FB_USER_ID
andCHROME_PROFILE_PATH
inhelpers.py
- Set
CONTAINER_SELECTOR
(see below)
The trick here is to avoid having to log in from the script by using the same Chrome profile every time the script runs. Run python3 tagged_photos.py
, a Chrome window will open, and you will be redirected to FB login. Once you log in, your login will persist, so you can close the window and run the script again, and it should work.
The photo downloader relies on a particular class that is likely to change over time because it's auto-generated by FB's frontend build process. It was .atb
when I wrote this but it'll probably change all the time. You'll have to dig into the source of the photo page to figure out what the right class is.
python3 tagged_photos.py
or python3 tagged_videos.py
The photos can take a while if you have a lot because it is navigating through the site in real time and I didn't figure out how to parallelize it because this is Python (would have been easy in JS). For about 900 photos it took almost an hour.
In line 66 of tagged_photos.py I needed to change "photos/data.json" to just "photos.json"