1
0
Переглянути джерело

[fb2] Switches to getContents (#742)

Nemo 5 роки тому
батько
коміт
ead7b2e8de
1 змінених файлів з 5 додано та 5 видалено
  1. 5 5
      bridges/FB2Bridge.php

+ 5 - 5
bridges/FB2Bridge.php

@@ -95,7 +95,7 @@ EOD;
 		. $pageID
 		. '&cursor={"card_id"%3A"videos"%2C"has_next_page"%3Atrue}&surface=mobile_page_home&unit_count=8';
 
-		$fileContent = file_get_contents($requestString);
+		$fileContent = getContents($requestString);
 
 		$articleIndex = 0;
 		$maxArticle = 3;
@@ -200,11 +200,11 @@ EOD;
 
 	//Builds the HTML from the encoded JS that Facebook provides.
 	private function buildContent($pageContent){
-
-		$regex = '/\\"html\\":\\"(.*?)\\",\\"replace/';
+		// The html ends with:
+		// /div>","replaceifexists
+		$regex = '/\\"html\\":(\".+\/div>"),"replace/';
 		preg_match($regex, $pageContent, $result);
-
-		return str_get_html(html_entity_decode(json_decode('"' . $result[1] . '"')));
+		return str_get_html(html_entity_decode(json_decode($result[1])));
 	}