I recently posted a link to this YouTube video in chat:


Here's the link to the message in chat that didn't onebox:


It didn't onebox because of the ampersand before the v in the query string parameter (even though the link is completely valid).

I've also noticed that many YouTube links won't onebox if there are other query string parameters (which is very common in YouTube links, it's how they track a number of different things like referrals).

That said, could you just parse the query string and pull the v parameter for the video ID instead of whatever you're doing now? All you need to do is call the ParseQueryString method on the HttpUtility class (you don't have to do it this way, but the point is, most of the work is done somewhere for you).

Also, if it's not too much trouble, would you recognize the shortened YouTube links that are formatted like this?


This is the link that's given out on the YouTube page when you want to share, and since I'm copying it to share it here, it would be nice if it was recognized.

  • 15
    I was gonna upvote this but I stopped reading at the first &
    – Ben Brocka
    Apr 17, 2013 at 18:57
  • We like Regexes, that's why!
    – Sklivvz
    Apr 19, 2013 at 13:08
  • 2
    @Sklivvz Leave it to a former Skeptics mod to think that what's built into the framework won't work. Granted, you might not want to attach a reference to System.Web but if it's there, use it (and this being an ASP.NET site, I can't imagine you don't have a reference somewhere in the app domain anyways). Now I know you can fix it quickly. Thanks, I'll expect it by EOD. Toodles!
    – casperOne
    Apr 19, 2013 at 15:25

1 Answer 1


As these things go, it wasn't that easy... but it's done and will be out in the next deployment:

  • Support for multiple parameters (e.g. http://www.youtube.com/watch?&v=ieFVN-PKLSA)
  • Support for shortened links (e.g. http://youtu.be/ieFVN-PKLSA)
  • Support for fragments or parameters with start time (e.g. http://youtu.be/ieFVN-PKLSA?t=3s or http://www.youtube.com/watch?v=ieFVN-PKLSA&feature=youtu.be&t=15s or also http://www.youtube.com/watch?v=ieFVN-PKLSA#t=15s)

Not supported:

  • non .com TLDs
  • anything I've haven't thought of
  • Well, the "have it by EOD" wasn't serious (although the "Toodles!" was deadly serious), but that's awesome, thank you! Will mark as accepted when I see it in chat.
    – casperOne
    Apr 19, 2013 at 17:15
  • @casperOne by the time you were expecting it, it was already done and I was writing this answer... the problem is usually not our speed, but the sheer amount of different things we need to do! Today was a relatively easy day when my normal developer duties got stuck and your request was at the top of the list :-)
    – Sklivvz
    Apr 19, 2013 at 23:50
  • Total fail: chat.stackexchange.com/messages/9079664/history You want that accept, you gotta work harder =)
    – casperOne
    Apr 21, 2013 at 4:51
  • @casperOne we didn't deploy yet - I'll do it on Monday when I'm fresh.
    – Sklivvz
    Apr 21, 2013 at 22:08
  • So fresh, so clean.
    – casperOne
    Apr 21, 2013 at 23:56
  • @casperOne done.
    – Sklivvz
    Apr 22, 2013 at 10:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .