[fb2] Switches to getContents (#742)

This commit is contained in:
Nemo 2018-07-10 06:59:47 +05:30 committed by Teromene
parent 0d80a19e84
commit ead7b2e8de

View file

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