PHP – Convert URLs to

Youtube has introduced a new URL shorthand –

For example takes you to

Annoyingly this means that any users pasting a URL into your video parsing scripts will be told it doesn’t work, so we’d best get updating those scripts!

Pop this in before you start processing the url, where $url is, not surprisingly, the url to be parsed.

[update 20110720-1657]While implementing this and similar for grabbing youtube thumbnails today I suddenly though, what if youtube ever starts using https? Well, the odds may be slim, but the costs of allowing for it are negligible, so why take the risk?


That particular link is the fantastic new video from my friends Six Toes – currently featured on the front of the Depeche Mode website.

6 thoughts on “PHP – Convert URLs to”

  1. Dunno if it’s useful for you but you can also say -mtime +1 day which searches for anything with a modification time of 1 day or more. Check the man page though because it is a little weird iirc, 1 day in your mind I think means 2 in finds opinion! Still useful though.

  2. Hey Robin. Posterous seems to be posting comments to the wrong topics – am looking into this!On that topic, yeah, finding within a fixed period is nice and simple. I had need to check for an absolute time, for which I found the syntax poorly explained, so thought it was worth noting for future reference…

Leave a Reply

Your e-mail address will not be published. Required fields are marked *