1
0
Fork 0
forked from blallo/rss-bridge

[InstagramBridge] Add option to filter for videos and pictures

Adds a new option 'media_type' to select from three choices:

- 'all' (Both): Returns pictures and videos (default choice)
- 'picture': Returns only pictures
- 'video': Returns only videos

References #553
This commit is contained in:
logmanoriginal 2017-07-25 15:10:06 +02:00
parent f6f3a213ef
commit 7dda088b3f

View file

@ -10,6 +10,17 @@ class InstagramBridge extends BridgeAbstract {
'u' => array(
'name' => 'username',
'required' => true
),
'media_type' => array(
'name' => 'Media type',
'type' => 'list',
'required' => false,
'values' => array(
'Both' => 'all',
'Video' => 'video',
'Picture' => 'picture'
),
'defaultValue' => 'all'
)
));
@ -39,6 +50,18 @@ class InstagramBridge extends BridgeAbstract {
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
foreach($userMedia as $media){
// Check media type
switch($this->getInput('media_type')){
case 'all': break;
case 'video':
if($media->is_video === false) continue 2;
break;
case 'picture':
if($media->is_video === true) continue 2;
break;
default: break;
}
$item = array();
$item['uri'] = self::URI . 'p/' . $media->code . '/';
$item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';