statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 236 forks source link

401 (Unauthorized) when using <?# YouTube YKC78xdtt4E /?> #903

Closed ghuntley closed 4 years ago

ghuntley commented 4 years ago

This video https://www.youtube.com/watch?v=YKC78xdtt4E as

<?# YouTube YKC78xdtt4E /?>

Results in

[ERRO] Content/PostProcess » RenderPostProcessTemplates » ProcessShortcodes » Document [C:/code/website/input/senate-submissions/questionable-claims-of-technical-superiority.md]: Response status code does not indicate success: 401 (Unauthorized).
[INFO]    Archives/PostProcess » Finished Archives PostProcess phase execution (5 output document(s), 5856 ms)
[INFO] -> Archives/Output » Starting Archives Output phase execution... (5 input document(s), 1 module(s))
[INFO]    Archives/Output » Finished Archives Output phase execution (5 output document(s), 76 ms)
[ERRO] Content/PostProcess » RenderPostProcessTemplates » Error while executing module ProcessShortcodes in Content/PostProcess: Response status code does not indicate success: 401 (Unauthorized).
[WARN] Content/Output » Skipping pipeline due to dependency error
[WARN] LinkValidation/Output » Skipping pipeline due to dependency error
[CRIT] One or more errors occurred. (Response status code does not indicate success: 401 (Unauthorized).)
daveaglick commented 4 years ago

Do other YouTube shortcodes work or are they all returning 401?

daveaglick commented 4 years ago

Interesting - confirmed it looks like it’s just this one video (or rather something about it that might also be true for other videos but not all). The oEmbed endpoint is definitely returning a 401: https://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYKC78xdtt4E&noapp=1

I’ll dig deeper and see if I can figure out what’s going on.

ghuntley commented 4 years ago

I'll just use the IFrame code for now. Thx as always Dave.

daveaglick commented 4 years ago

This looks like a known problem with YouTube for certain videos: https://core.trac.wordpress.org/ticket/14377 https://stackoverflow.com/questions/5654691/why-isnt-oembed-showing-the-youtube-video https://github.com/humhub/humhub/issues/2501

It's possibly due to a video being marked as "unembeddable" but that's not totally clear. In any case, I'm going to close this as NMP (not my problem). I think returning an error is the correct result (as opposed to some sort of fallback) - if the expected embed doesn't render, it's something that should be corrected.