Skip to content

feat(facebook): name the age gate instead of blaming visibility - #17

Merged
vannt-dev merged 1 commit into
mainfrom
feat/facebook-age-gate-message
Sep 1, 2026
Merged

feat(facebook): name the age gate instead of blaming visibility#17
vannt-dev merged 1 commit into
mainfrom
feat/facebook-age-gate-message

Conversation

@vannt-dev

Copy link
Copy Markdown
Owner

Follow-up to #16, which fixed the transport-level failure but left this case reporting the wrong reason.

The problem

A Facebook reel can be public and still serve an anonymous visitor nothing, because Facebook restricts it to viewers over 18. Every such link ended at facebookNoVideo:

Could not extract media from this Facebook post. Make sure it is public; private posts and closed groups require a login.

So the reader goes and checks visibility, finds it is already public, and is left with nowhere to go. That is exactly how the original report played out.

The change

A new facebookAgeRestricted kind carries the case, with its own English and Vietnamese wording saying the post's visibility is not the problem.

Detection keys on the route Facebook names in the document, CometAgeInappropriateLoggedOutErrorRoute. The visible sentence is drawn by script and never reaches the HTML, so matching the text a reader sees would have found nothing — worth stating because it is the non-obvious part.

Measured before relying on the marker:

page occurrences
age-gated reel 16
public post permalink 0
/watch/?v=… 0
logged-out home page 0

All three extraction strategies report into one flag rather than letting the last page tried decide, since any of them may be the one that lands on the gate.

Verification

  • flutter test — 222 pass. extraction_failure_text_test.dart already iterates ExtractionFailureKind.values, so the new kind is covered in both locales without a new test there.
  • flutter analyze — No issues found
  • New fixture test pins the classification; the existing Facebook tests still distinguish the ordinary no-media case.
  • End to end against the reported link, facebook.com/share/r/1Bszhs9VD4/, run through the real extractor and the real network:
KIND=facebookAgeRestricted CODE=facebook_age_gated

Scope

This makes the failure honest; it does not make the video downloadable. Reaching age-gated media needs the viewer's own authenticated session, which would want flutter_secure_storage — the project stores settings in shared_preferences today, and a session cookie does not belong there in plaintext. That remains an open decision, not part of this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RjyfcAcWuaNcXTc4ZdTofM

A reel can be public and still serve an anonymous visitor nothing,
because Facebook restricts it to viewers over 18. Every such link ended
at `facebookNoVideo`, whose text asks the reader to make sure the post is
public -- the one thing that is already fine. They check it, find nothing
wrong, and are left with no way forward.

`facebookAgeRestricted` now carries that case, with its own English and
Vietnamese wording that says the post's visibility is not the problem.

The gate is recognised by the route Facebook names in the document,
`CometAgeInappropriateLoggedOutErrorRoute`. The sentence a reader sees is
drawn by script and never reaches the HTML, so matching the visible text
would have found nothing. Measured before relying on it: the marker
appears 16 times on an age-gated reel and not once on a public post, a
watch page, or the logged-out home page.

All three strategies report into the same flag rather than the last page
tried deciding, since any of them may be the one that lands on the gate.
@vannt-dev
vannt-dev merged commit 0aa3000 into main Sep 1, 2026
7 checks passed
@vannt-dev
vannt-dev deleted the feat/facebook-age-gate-message branch September 1, 2026 01:31
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