Fix bug because of a modification of instagram source page json
content
This commit is contained in:
parent
3822e77561
commit
d6693f4346
1 changed files with 7 additions and 10 deletions
|
@ -29,31 +29,28 @@ class InstagramBridge extends BridgeAbstract{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = strpos($script->innertext, 'window._jscalls');
|
$pos = strpos(trim($script->innertext), 'window._sharedData');
|
||||||
if (false === $pos)
|
if (0 !== $pos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$innertext = $script->innertext;
|
$innertext = $script->innertext;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$json = trim(substr($innertext, $pos+15), ' =;');
|
|
||||||
$pos = strpos($json, '}]],');
|
$json = trim(substr($innertext, $pos+18), ' =;');
|
||||||
$json = substr($json, $pos+4, -4);
|
|
||||||
$data = json_decode($json);
|
$data = json_decode($json);
|
||||||
|
|
||||||
$userMedia = $data[2][0]->props->userMedia;
|
$userMedia = $data->entry_data->UserProfile[0]->userMedia;
|
||||||
|
|
||||||
|
|
||||||
foreach($userMedia as $media)
|
foreach($userMedia as $media)
|
||||||
{
|
{
|
||||||
$image = $media->images->standard_resolution;
|
$image = $media->images->standard_resolution;
|
||||||
|
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = $media->link;
|
$item->uri = $media->link;
|
||||||
$item->content = '<img src="' . htmlentities($image->url) . '" width="'.htmlentities($image->width).'" height="'.htmlentities($image->height).'" />';
|
$item->content = '<img src="' . htmlentities($image->url) . '" width="'.htmlentities($image->width).'" height="'.htmlentities($image->height).'" />';
|
||||||
|
|
Loading…
Reference in a new issue