How to avoid the YouTube posting bug

You’re trying to post a YouTube video, but you get a popup saying “You can’t embed media items in a post.” Here’s how to avoid that. There are a couple of minor variations.

I haven’t written my post yet

Write your post normally but do not include the YouTube link(s). When you are satisfied with the post, hide the preview window (see the << button in the lower-right). Then, insert the links in the desired locations. Note that the links should each appear on a line by themselves. Then post.

Are you still getting the error? Then you must perform an additional modification. Again keeping the preview window closed, append the string &1 to your link. If that doesn’t work, change it to &2. Keep incrementing until it does work. It should look something like this:
https://www.youtube.com/watch?v=muK6gFtv7_o&1
And if that doesn’t work, increment:
https://www.youtube.com/watch?v=muK6gFtv7_o&2

I’m editing my post and get the error

You will always run into the bug when you edit a post containing a YouTube link. Therefore you must always use the method of appending a string. Again, hide the preview window when you are done making the text edits. Then, either append the &1 or increment the number if you have already used the method.

I wrote my post already but didn’t know about these instructions yet, so I’m getting the error

Then it works the same as editing a post.

I didn’t hide the preview but it worked anyway

That will happen if you are quick and hit the post button before the YouTube preview was generated. You can get away with it if you’re fast, but it’s more reliable to just hide the preview. That will always work as long as you do it before you paste the link.

Why all this crap?

It’s a bug in the forum software. You can read some of the gory details here:

A sincere thank you for that public service message. It definitely should be pinned. Some of us have been following this problem for what turns out to be 18 months now (customer service seems kinda slow around here!) but complaints about not being able to post YouTube links keep cropping up. That excellent summary should help, thanks again.

Or just make the post from your phone. It doesn’t have a preview window, so a simple cut and paste of the URL works.

If anyone has posted the link before, then hiding the preview window is insufficient, phone or not.

A million thank yous for this.

Glad to help! Let me know if anything is unclear.

In that case I’ve never happened to post a link someone else has posted before, because I’ve never had a problem.

It’s going to be pretty rare obviously, but it’s happened to me a couple of times. There’s a good chance of collision in breaking news threads especially.

Nope, still works with no problem on my phone even with previously posted URLs.

I’ve noticed that sometimes people will try to post a video with the youtu.be URL which doesn’t imbed, rather than youtube.com, and I believe Discourse only recognizes the latter as a video it can display in a post.

Just thought I’d throw out that tidbit.

I’ve never had a problem either. I just post the link and add a slash. I can’t remember it not working.

Pinned

The bug arises when the exact text of the URL has already been associated with a preview. There are many other ways to perturb the URL: use youtube.com instead of www.youtube.com, append other characters, use http rather than https, etc. However, they all still suffer the problem that once posted, the URL can’t be posted again.

I used the &1, &2 method because it is easy to describe and remember, and importantly can be tweaked at will. If you’re the type to edit your post a half-dozen times (and some of us are), then it’s important to have a method that keeps working.

That must be it then… I rarely preview. Another fix might be to do all the previewing first and add the link right before final posting?

Well yes, that is what I wrote in my post. However, in the case where the link was already posted, or you’re editing your post, or you slipped up with the preview, then you need to go through the &1 trick. If you rarely preview or edit, then you probably won’t run into the bug very often.

I post from my phone. I can post a youtube without problems. But can’t edit afterwards.

I break the preview.

That way the post can be edited later.

Normally the post would explain what the video contains.

Guns used in Doctor No are inaccurate.
Link https://youtu.be/JPMuHJxAs94?si=GR5gCVB_wYTrVQ0N

Read the OP and you will discover how to edit your post and retain the YouTube preview.

I read it. It’s an effective solution.

Apparently every link I’ve tried to post had been previously posted – I’ve had the preview window closed since last year, and haven’t been able to post a single one.