 				_.each metas, (value, key) ->
 					if _.isString value
 						data.meta[changeCase.camelCase('oembed_' + key)] = value
-			if data.parsedUrl?.query?.url?
-				data.meta['oembedUrl'] = data.parsedUrl.query.url
+				data.meta['oembedUrl'] = url

			data.requestOptions.path = consumerUrl.path

RocketChat.callbacks.add 'oembed:afterParseContent', (data) ->
	if data.parsedUrl?
		url = URL.format data.parsedUrl
		provider = providers.getProviderForUrl url
		if provider?
			if data.content?.body?

providers.registerProvider
	urls: [new RegExp('https?://www.slideshare.net/[^/]+/[^/]+')]
	endPoint: 'https://www.slideshare.net/api/oembed/2?format=json&maxheight=200'
providers.registerProvider
	urls: [new RegExp('https?://www.dailymotion.com/video/\\S+')]
	endPoint: 'https://www.dailymotion.com/services/oembed?maxheight=200'

RocketChat.oembed = {}
RocketChat.oembed.providers = providers
