Recover original publish dates for Facebook photos/videos via Graph API
Project description
fb-metadata-recovery
Recover original publish dates for Facebook photos and videos that get stripped during upload.
The Problem
When you upload photos/videos to Facebook, the original EXIF metadata (including capture date) is stripped. When you later use Facebook's "Download Your Information" tool, the compressed files have incorrect or missing dates. This tool helps you rebuild that metadata.
Quick Start
pip install fb-metadata-recovery
fb-recovery download -o ~/fb_photos
How It Works
- Download your photos from Facebook via Graph API (organized by album)
- Parse your Facebook bulk download HTML files for metadata
- Match items using perceptual hashing to handle Facebook's re-compression
- Recover original publish dates and rename files accordingly
Setup
1. Get a Facebook Access Token
- Go to Facebook Graph API Explorer
- Create or select an app
- Click Generate Access Token
- Select permissions:
user_photos- Access your photosuser_videos- Access your videosuser_posts- Access your posts (optional)
- Copy the token
2. Download Your Information from Facebook
- Go to Facebook Settings → Your Information → Download Your Information
- Select:
- Format: JSON
- Quality: High (for best matching)
- Date range: All time
- Select: Posts, Photos, Videos
- Download and extract the ZIP file
Usage
Download All Photos (by album)
fb-recovery download -o ~/fb_photos
Creates folder structure:
fb_photos/
├── Total Carnage/
│ ├── 2012-04-10_Total Carnage_3771498489821.jpg
│ └── ...
├── Halloween 2011/
│ ├── 2011-11-13_Halloween 2011_2636658399528.jpg
│ └── ...
└── download_metadata.json
Parse Facebook Bulk Download
fb-recovery parse ~/Downloads/facebook-yourname-20240101/ -o metadata.json
Extracts dates, camera info, and captions from Facebook's HTML export.
Match & Recover Dates
fb-recovery match metadata.json --bulk-dir ~/fb_export/ -o report.csv
Matches photos between Graph API and bulk download to recover original dates.
Full Pipeline
fb-recovery full --bulk-dir ~/Downloads/facebook-export/ -o output/
Output Formats
| File | Description |
|---|---|
photos_metadata.csv |
Photos with dates, camera info, CDN URLs |
videos_metadata.csv |
Videos with dates, titles, file paths |
download_metadata.json |
Full metadata for all media |
recovery_report.csv |
Matched items with recovered dates |
Commands
| Command | Description |
|---|---|
fb-recovery download |
Download all photos via Graph API (by album) |
fb-recovery parse |
Parse Facebook HTML export for metadata |
fb-recovery match |
Match scan results against bulk download |
fb-recovery scan |
List all photos/videos from Graph API |
fb-recovery full |
Run full pipeline |
Token Caching
Your access token is cached at ~/.fb-metadata-recovery/token.json with restricted permissions (600). To clear it:
rm ~/.fb-metadata-recovery/token.json
Privacy
This tool runs entirely locally. Your access token and media files never leave your machine. No data is sent to third parties.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fb_metadata_recovery-0.1.0.tar.gz.
File metadata
- Download URL: fb_metadata_recovery-0.1.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96c1a2b3b43be19f77889ddb081c19d6b6382bbb5deb1347d1d1e530f06f6307
|
|
| MD5 |
4a0ebce1e4ac6d9c2e29f0a347788449
|
|
| BLAKE2b-256 |
268def6e10ff3d904b239fad3955c71cca6195b8e1f33f83df14135e0c19efd9
|
File details
Details for the file fb_metadata_recovery-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fb_metadata_recovery-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf50ebd4bcec4b4f6300b13f5b5cc944d95dde75de765e208e108ab9a07d43d5
|
|
| MD5 |
4db4b6b45578877095b93354ba6f15b5
|
|
| BLAKE2b-256 |
8a5d42df022818975b5a7e5779546953abe200e56c51316338e905f833d1c1b7
|