Skip to content

Hand Facebook photo posts to gallery-dl as post links - #17

Merged
stefan-azentrius merged 1 commit into
mainfrom
facebook-photo-posts
Oct 25, 2026
Merged

stefan-azentrius merged 1 commit into
mainfrom
facebook-photo-posts

Conversation

@stefan-azentrius

Copy link
Copy Markdown
Contributor

Summary

Facebook posts with pictures failed with "unsupported". A shared facebook.com/share/p/... link resolves to story.php?story_fbid=...&id=....

  • yt-dlp, which goes first for Facebook, finds no video in such a post ("No video formats found").
  • gallery-dl 1.32.18 then matches story.php with its profile extractor, as a user named "story.php", and stops with KeyError: 'set_id'.

gallery-dl's set extractor handles posts, but only as <id>/posts/<story_fbid> or permalink.php?story_fbid=.... A check on the server with the two failing posts and the Facebook cookies (gallery-dl -g, nothing downloaded) gave:

Link given to gallery-dl Extractor Files
<id>/posts/<story_fbid> set 1 per post, the post's picture
permalink.php?story_fbid=...&id=... set 20 (the limit), the page's photo stream, not the post
  • gallery_dl_url() in app/fetch.py turns story.php and permalink.php links with a story_fbid (digits or a pfbid... id) and a numeric id into https://www.facebook.com/<id>/posts/<story_fbid>. Any other link stays as it is.
  • Only gallery-dl gets the new form. yt-dlp keeps the original link, which works for videos.
  • The host allowlist is unchanged; the new link is always on www.facebook.com and is built from the two ids only.
  • CHANGELOG: an entry in "Unreleased".

Test

  • tests/test_fetch.py: a photo post goes through yt-dlp ("No video formats found") to gallery-dl, which gets the posts link while yt-dlp got the original one (fake downloader as a real subprocess). The conversion is tested for story.php, permalink.php, pfbid ids and parameters in another order. Links stay unchanged without id, with path characters in an id, or as reels, photo links and Instagram links. All 11 new tests failed on main before the change.
  • Locally: ruff clean, pytest 163 passed and 3 skipped (no FFmpeg), node --test 33 of 33, git diff --check clean.
  • Not yet checked: a real share of the two posts after the update.

A shared post resolves to story.php, which gallery-dl took for a profile named "story.php" and failed on, after yt-dlp found no video in it. gallery-dl now gets story.php and permalink.php links as <id>/posts/<story_fbid> and downloads the post's own pictures; yt-dlp keeps the original link.
@stefan-azentrius
stefan-azentrius merged commit 22b6e4e into main Oct 25, 2026
8 checks passed
@stefan-azentrius
stefan-azentrius deleted the facebook-photo-posts branch October 25, 2026 22:18
stefan-azentrius added a commit that referenced this pull request Oct 25, 2026
## Summary

After #17, a Facebook post with an article picture came back as a pack
with a short video (3 seconds of sound) instead of the picture. yt-dlp,
which goes first for every Facebook link, took a video from the post's
page; an hour earlier it had found no video there at all. The check on
the server for #17 showed that gallery-dl finds exactly the post's one
picture.

- Facebook **posts** (`kind == "post"`, e.g. resolved `story.php`,
`permalink.php` and `<id>/posts/<id>` links) now go to gallery-dl first,
as Instagram does, with the post link from #17. yt-dlp only runs when
gallery-dl finds nothing, e.g. for a post with a video only, and gets
the original link.
- Facebook **reels and videos** (`/reel/`, `/watch`, `/videos/`) still
go to yt-dlp first.
- CHANGELOG: an entry in "Unreleased".

## Test

- `tests/test_fetch.py`:
- A post goes to gallery-dl first, with the post link, and yt-dlp does
not run.
- A post where gallery-dl finds nothing falls back to yt-dlp with the
original link.
  - Reel, watch and video links still go to yt-dlp first.
  - The two post tests failed with the old order.
- Locally: ruff clean, pytest 167 passed and 3 skipped (no FFmpeg), node
--test 33 of 33, `git diff --check` clean.
- Not yet checked: preparing the post again after the update.
stefan-azentrius added a commit that referenced this pull request Oct 26, 2026
…#19)

## Summary

Prepares the release 0.1.2 with everything on `main` since 0.1.1 (#7 to
#18).

- `__version__` in `app/__init__.py`: 0.1.1 to 0.1.2. The image label,
the extension's manifest and the version on the page follow from it.
- `CHANGELOG.md`: the section "Unreleased" becomes "0.1.2 – 2026-10-26",
with a summary that now names the Facebook posts with pictures (#17,
#18). The "Upgrading" note names the extension zip the release workflow
attaches.

After the merge, the `release` workflow builds the source archive,
`sharewerk-extension-0.1.2.zip` and the image
`ghcr.io/azentrius/sharewerk:0.1.2`, each with build provenance, and
takes the notes from this section.

## Test

- `tools/release-notes.sh 0.1.2` prints the section (54 lines).
- Locally: ruff clean, pytest 167 passed and 3 skipped (no FFmpeg), node
--test 35 of 35 (app, extension, PWA update), `git diff --check` clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant