Skip to content

Fix stale YouTube title and description after SPA navigation - #387

Open
vicky469 wants to merge 1 commit into
kepano:mainfrom
vicky469:fix/youtube-spa-metadata
Open

vicky469 wants to merge 1 commit into
kepano:mainfrom
vicky469:fix/youtube-spa-metadata

Conversation

@vicky469

Copy link
Copy Markdown

After navigating from video A to video B in the same YouTube tab, clipping can combine B's content with A's title and description. YouTube can retain A's Open Graph tags and structured data; when the extractor rejects those values, the generic metadata fallback restores them.

This adds a fallback to the rendered watch title and description, scoped to a ytd-watch-flexy whose video-id matches the requested URL. It uses the expanded description when available, otherwise the rendered snippet. An explicit extractor opt-in prevents empty title/description values from falling back to rejected metadata; other extractors keep their existing behavior.

Follow-up to #174 and #198. Related: obsidianmd/obsidian-clipper#735. Clipper's bug-report guidance directs incorrect-content issues to Defuddle.

Validation:

  • Reproduced stale head metadata after real same-tab YouTube navigation. Verified the built parser against the captured rendered DOM with the current JSON-LD omitted to exercise the missing-schema fallback.
  • Added an anonymized HTML fixture and regression tests covering sync/async parsing, collapsed and absent descriptions, mismatched video IDs, partial current metadata, and preservation of another extractor's fallback. Observed the regression tests fail before the fix.
  • npm test: 585 passed.
  • npm run test:jsdom: 585 passed.
  • npm run build, npm run size, and npm run lint:innerhtml: passed.

Use title and description from the rendered watch page only when its video ID matches the requested URL. Prevent the generic metadata fallback from restoring rejected values, while retaining existing fallback behavior for other extractors.

This branch has not been deployed

No deployments
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