if format.nil? || format == :xml
        # {The specification}[http://oembed.com/#section4] says XML discovery should have
        # type="text/xml+oembed" but some providers use type="application/xml+oembed"
        provider_endpoint ||= /<link[^>]*href=['"]*([^\s'"]+)['"]*[^>]*(application|text)\/xml\+oembed[^>]*>/.match(res)[1] rescue nil
        provider_endpoint ||= /<link[^>]*(application|text)\/xml\+oembed[^>]*href=['"]*([^\s'"]+)['"]*[^>]*>/.match(res)[2] rescue nil