Embedly is a great service for generic embedding of content. Have you seen posterous? How they can just accept any link to a video on youtube, a picture on flickr, whatever, and it gets properly embedded? I imagine they could use Embedly to accomplish that.
Anyway. They have a jQuery script to do embedding, but in the middle of if is this behemoth of a code smell:
Oh noes a global variable! The implication of this is that you can only run one call to embedly at a time. This sucks if you have different needs for different things and want to run a few at the same time, since array values get overwritten between calls, and shenanigans ensue.
I did use their file as my starting point and then sort of converted things as I went to not use the global array and be written in coffeescript, so the basic flow of the logic is all them, I just cleaned it up.
Go forth and enjoy.