1
0
Fork 0
forked from blallo/rss-bridge
This commit is contained in:
pauder 2013-10-29 10:40:31 +01:00
parent c6ec5c45d1
commit 40f6e51b06

View file

@ -22,21 +22,35 @@ class InstagramBridge extends BridgeAbstract{
}
// "standard_resolution":{"url":"http:\/\/distilleryimage6.s3.amazonaws.com\/5ff1829036bc11e3b6c622000a1f92d1_7.jpg","width":612,"height":612}
if (preg_match_all('/"standard_resolution":\{"url":"(http:[^"]+)","width":(\d+),"height":(\d+)\}/', $text, $matches))
$image = '"(\w+)":\{"url":"(http:[^"]+)","width":(\d+),"height":(\d+)\}';
if (preg_match_all('/"created_time":"(\d+)"\s*,\s*"images":\{'.$image.','.$image.','.$image.'\}/', $text, $matches))
{
foreach($matches[0] as $key => $dummy)
{
$imageurl = stripslashes($matches[1][$key]);
$width = (int) $matches[2][$key];
$height = (int) $matches[3][$key];
$timestamp = (int) $matches[1][$key];
$images = array();
$pos = 2;
for($i = 0; $i < 3; $i++)
{
$imagetype = $matches[$pos++][$key];
$images[$imagetype] = array(
'url' => stripslashes($matches[$pos++][$key]),
'width' => (int) $matches[$pos++][$key],
'height' => (int) $matches[$pos++][$key]
);
}
$item = new \Item();
$item->uri = $imageurl;
$item->content = '<img src="' . htmlentities($imageurl) . '" width="'.$width.'" height="'.$height.'" />';
$item->title = basename($imageurl);
$item->uri = $images['standard_resolution']['url'];
$item->content = '<img src="' . htmlentities($images['standard_resolution']['url']) . '" width="'.$images['standard_resolution']['width'].'" height="'.$images['standard_resolution']['height'].'" />';
$item->title = basename($images['standard_resolution']['url']);
$item->timestamp = $timestamp;
$this->items[] = $item;
}
}