+ // Extract the json data from the html code.
+ $json_match_expr = '/window._sharedData = (.*);/';
+ $ret = preg_match($json_match_expr, $html, $matches);
+ if ($ret !== 1) {
+ trigger_error("Cannot match expression: $json_match_expr\n", E_USER_ERROR);
+ return NULL;
+ }
+
+ return $this->jsonToXml($matches[1], 'instagram');
+ }
+
+ /**
+ * Make the Facebook HTML processable.
+ */
+ private function preprocess_html_facebook_com($html) {
+ $html = str_replace('<!--', '', $html);
+ $html = str_replace('-->', '', $html);
+ return $html;