How to modify the HTML formatting of an oEmbed link?

I am trying to add oEmbed DeviantArt integration to a custom theme.

I found that first step is quite easy, I added

wp_oembed_add_provider( 'http://*.deviantart.com/#/d*', 'http://backend.deviantart.com/oembed' );   

to theme’s functions.php.

Now, I would like to change the default HTML output to add more information, available in DeviantArt JSON response (DeviantART reference), like author_name, author_url, etc.

If I have studied well the WP code that manage the output is inside function data2html in class-oembed.php, but I don’t like change the code here.

How can I add a function to my theme, to achieve the desired result?

Solutions Collecting From Web of "How to modify the HTML formatting of an oEmbed link?"

WP_oEmbed::data2html() has a filter, oembed_dataparse. You can use this to change the output, based on the extra data which is passed as the second parameter.

Something like this for example:

add_filter( 'oembed_dataparse', 'wpse17461_oembed_dataparse', 10, 3 );
function wpse17461_oembed_dataparse( $html, $data, $url )
{
    if ( FALSE !== strpos( $url, 'deviantart.com' ) ) {
        return $html . '<br/>Author: ' . $data->author_name;
    }
    return $html;
}