feat(author): ask YouTube and Vimeo whether they have a hosted video

Merged
AL
3d ago
+233-10

Part of #218: item 4, "A YouTube or Vimeo address is checked to exist, where the network is there". Items 5 and 6 and the open question stay in #218.

What changes

  • A build asks YouTube's or Vimeo's oEmbed whether it has the video. Before, an address was held to its form only, so a made-up id built and showed a dead player.

  • What a status means is each host's own list, as seen on real videos on 2026-11-20:

    HostStatusSeen forThe build
    YouTube400an id it never hadproblem
    YouTube404a video taken downproblem
    YouTube403a private video (two)note: its owner can open it
    YouTube401not seen; said to be embedding turned offnote
    YouTube200public, and one that asks a viewer's agenothing
    Vimeo404no such video; per Vimeo's help centre also an unlisted one without the rest of its linkproblem, which says to give the whole link
    Vimeo200public; per the help centre also behind a password or let to some sites onlynothing
    Vimeo403Vimeo refusing the asker's network (its help centre)nothing
  • Only the host's own answer counts. A sandbox's proxy or a school's filter answers for the host, which would otherwise refuse a build with no way round or put a note on every video. Each host sends a status that is no video in a way of its own: YouTube that status's words alone (Bad Request, Not Found, Forbidden) under its JSON type, Vimeo a page of them (404 Not Found, text/html). A status counts only when it comes so. A page of the box's own, the words under another type, or another status's words say nothing. A box that copied both the words and the type would still pass for the host; none was seen. If a host changes how it answers, the check goes quiet, not wrong.

  • A host that does not answer costs ten seconds once. After the first video with no answer, that host is not asked again in that build; the other still is. One video named twice is asked once.

  • YouTube is asked by the video's watch address. Its oEmbed answers 404 for the /embed/ and /v/ forms of a video it has.

  • Panopto and Echo360 have no public endpoint and are not asked. A read asks nothing.

  • It runs on the build page too: each endpoint sent CORS headers with a 200 and with a refusal, and the page's policy allows any connect-src.

  • The MCP server asks through publicFetch, which passes the timeout's signal on.

Privacy

A build now sends a hosted video's address to that site. The author README, the MCP README, SECURITY.md and design/author.md say so.

Tests

  • New: what is asked and how often; each problem and note; a status that means nothing for its host; a box answering for the host five ways (its own page, the bare words under text/plain, another status's words, and two for Vimeo); no network, each host asked once for four videos; and one host down with the other still refusing its missing video.
  • The suites never reach either host: a setup file (tests/helpers/oembed.ts) answers oEmbed requests for the author's Node project, and a test passes its own fetch to say otherwise.
  • Author 281 Node and 2 Chromium tests, skills 82, MCP 21, type check.
  • By hand against the live hosts: a made-up id and a removed video are refused, a private video builds with its note, vimeo.com/1 is refused, and real videos on both build with nothing said.

Self-review, 2026-11-20

The first version trusted any 400, 401, 403 or 404, called 401 and 403 "private or let to some sites only" for both hosts without having seen either, and waited ten seconds a video with no network. All three are changed above.