Skip to content

YouTube links do not generate link previews in v0.31.0 #6399

Closed

Description

@antomal

Check before submitting

  • I searched existing issues and did not find a duplicate

Describe the bug

YouTube links do not generate a link preview.

For example: https://www.youtube.com/watch?v=iFmphiZhIKA

After adding this URL to a memo, only the link itself is displayed and no preview card is generated.
Other links can generate previews as expected.
I can reproduce the same behavior both on my self-hosted Memos instance and on the official Memos demo.
Expected behavior: YouTube links should generate a preview card with the video title and thumbnail.

Steps to reproduce

  1. Create a new memo.
  2. Add this URL: https://www.youtube.com/watch?v=iFmphiZhIKA
  3. Save the memo.
  4. Observe that no link preview is generated.

Memos version

v0.31.0

Additional context

In v0.30.0, Memos had a YouTube-specific fallback for www.youtube.com/watch URLs that generated the thumbnail from img.youtube.com.
The link preview implementation was refactored in v0.31.0, and that YouTube-specific fallback no longer appears to be present.

It may also be worth checking common YouTube URL variants such as:

so link previews work consistently regardless of which standard YouTube URL format is used.

Activity

  1. added theissue type on Sep 28, 2026
  2. Juice-de-Orange commented on Sep 29, 2026

    @Juice-de-Orange

    Dug into this: the removed YouTube fallback isn't the whole story. A YouTube watch page is 1.2–1.4 MB and starts with a ~680 KB inline <script>, so <title>, the oEmbed <link> and the og:* tags only show up around 700 KB (checked three videos with the MemosBot/1.0 user agent). fetch() parses only the first maxHTMLMetaBytes (512 KB), finds nothing, and returns an empty preview without an error. Same for youtu.be and m.youtube.com. The demo does the same: /api/v1/memos/-/linkMetadata returns empty fields for the URL in the report and full ones for a GitHub URL.

    With the cap bumped to 2 MB locally, title and thumbnail come back through the page's own oEmbed link. So the new code already handles YouTube, it just never gets that far.

    v0.30.0 had the same 512 KB cap, the img.youtube.com fallback only hid it (image but no title).

    Two ways to fix it: call https://www.youtube.com/oembed?format=json&url=<video url> directly for YouTube hosts (works for watch?v=, youtu.be/, m.youtube.com), or read further than 512 KB, e.g. up to </head>.

  3. added a commit that references this issue on Sep 29, 2026
    0ae9f52
  4. johnnyjoygh commented on Oct 9, 2026

    @johnnyjoygh
    Contributor

    Thanks for the detailed report and investigation. The 512 KB HTML limit stopped before YouTube’s metadata and oEmbed link.

    We’ve fixed the general preview fetcher: when the first 512 KB lacks a title or image, it reads further, up to a 2 MB limit. And verified the reported video through www.youtube.com, m.youtube.com, and youtu.be; all three returned a title and thumbnail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions