I like this, it's nice that users can put the id or full URL as it saves me having to explain how to get the url a hundred times to members. :P
Just noticed one bug and not sure if it was posted.
I was trying to make a quick explanation to users by writing the code [youtube]URL[/youtube] inside of [noparse] tags but your code still removes the full url and changes it to just an id which is a bit confusing to members (they don't know where the id came from :P).
Not a big deal but you should make your hack detect if the tag is inside of [noparse] tags or not.