Skip to main content

Recover original publish dates for Facebook photos/videos via Graph API

Project description

fb-metadata-recovery

PyPI version Python License: MIT

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

  1. Download your photos from Facebook via Graph API (organized by album)
  2. Parse your Facebook bulk download HTML files for metadata
  3. Match items using perceptual hashing to handle Facebook's re-compression
  4. Recover original publish dates and rename files accordingly

Setup

1. Get a Facebook Access Token

  1. Go to Facebook Graph API Explorer
  2. Create or select an app
  3. Click Generate Access Token
  4. Select permissions:
    • user_photos - Access your photos
    • user_videos - Access your videos
    • user_posts - Access your posts (optional)
  5. Copy the token

2. Download Your Information from Facebook

  1. Go to Facebook Settings → Your Information → Download Your Information
  2. Select:
    • Format: JSON
    • Quality: High (for best matching)
    • Date range: All time
    • Select: Posts, Photos, Videos
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fb_metadata_recovery-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fb_metadata_recovery-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

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

Hashes for fb_metadata_recovery-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96c1a2b3b43be19f77889ddb081c19d6b6382bbb5deb1347d1d1e530f06f6307
MD5 4a0ebce1e4ac6d9c2e29f0a347788449
BLAKE2b-256 268def6e10ff3d904b239fad3955c71cca6195b8e1f33f83df14135e0c19efd9

See more details on using hashes here.

File details

Details for the file fb_metadata_recovery-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fb_metadata_recovery-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf50ebd4bcec4b4f6300b13f5b5cc944d95dde75de765e208e108ab9a07d43d5
MD5 4db4b6b45578877095b93354ba6f15b5
BLAKE2b-256 8a5d42df022818975b5a7e5779546953abe200e56c51316338e905f833d1c1b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page