private function extractOembed(Response $response)
    {
        // extract from xml
        if (($response->getUrl()->getExtension() === 'xml') || ($response->getUrl()->getQueryParameter('format') === 'xml')) {
            if ($xml = $response->getXmlContent()) {
                foreach ($xml as $element) {
                    $content = trim((string) $element);

                    if (stripos($content, '<![CDATA[') === 0) {
                        $content = substr($content, 9, -3);
                    }

                    $this->bag->set($element->getName(), $content);
                }
            }
            // extract from json
        } else {
            if (($json = $response->getJsonContent()) && empty($json['Error'])) {
                $this->bag->set($json);
            }
        }
    }