You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node.warn('Instagram node has failed to fetch latest liked media : '+err);
111
+
node.warn('Instagram node has failed to fetch latest media : '+err);
108
112
}
109
113
110
-
for(vari=0;i<medias.length;i++){
111
-
if(node.inputType==="like"){// like is a special case as per Instagram API behaviour
112
-
if(areWeInPaginationRecursion===false){// need to set the pointer of latest served liked image before pagination occurs
113
-
idOfLikedReturned=medias[0].id;
114
+
if(medias){
115
+
for(vari=0;i<medias.length;i++){
116
+
if(node.inputType==="like"){// like is a special case as per Instagram API behaviour
117
+
if(areWeInPaginationRecursion===false){// need to set the pointer of latest served liked image before pagination occurs
118
+
idOfLikedReturned=medias[0].id;
119
+
}
120
+
if(medias[i].id===node.latestLikedID||node.latestLikedID===null){// we finally found the image we already returned or has been there at init
121
+
node.latestLikedID=idOfLikedReturned;// we need to assign the latest liked to the one we returned first => can only do node at the end, otherwise we'd never match break condition and always return everything
122
+
carryOnPaginating=false;
123
+
break;
124
+
}
114
125
}
115
-
if(medias[i].id===node.latestLikedID||node.latestLikedID===DUMMY){// we finally found the image we already returned or has been there at init
116
-
node.latestLikedID=idOfLikedReturned;// we need to assign the latest liked to the one we returned first => can only do node at the end, otherwise we'd never match break condition and always return everything
117
-
carryOnPaginating=false;
118
-
break;
126
+
127
+
if(node.inputType==="photo"&&i===0&&(areWeInPaginationRecursion===false)){// only set the served self content ID to equal the first media of the first pagination page and ignore on subsequent pages
128
+
idOfSelfReturned=medias[i].id;
119
129
}
120
-
}
121
-
122
-
if(node.inputType==="photo"&&i===0&&(areWeInPaginationRecursion===false)){// only set the served self content ID to equal the first media of the first pagination page and ignore on subsequent pages
123
-
idOfSelfReturned=medias[0].id;
124
-
}
125
-
126
-
if(node.inputType==="photo"&&(medias[i].id===node.latestSelfContentID)){// if we say to the Insta API that we want images more recent than image id "blah", it returns image with that id too
127
-
//deliberate no-op
128
-
}elseif(medias[i].type===IMAGE){
129
-
varurl=medias[i].images.standard_resolution.url;
130
-
if(node.outputType==="link"){
131
-
msg.payload=url;
132
-
node.send(msg);
133
-
}elseif(node.outputType==="file"){
134
-
downloadImageAndSendAsBuffer(node,url,msg);
130
+
131
+
if(node.inputType==="photo"&&(medias[i].id===node.latestSelfContentID)){// if we say to the Insta API that we want images more recent than image id "blah", it returns image with that id too
132
+
//deliberate no-op
133
+
}elseif(medias[i].type===IMAGE){
134
+
varurl=medias[i].images.standard_resolution.url;
135
+
if(node.outputType==="link"){
136
+
msg.payload=url;
137
+
node.send(msg);
138
+
}elseif(node.outputType==="buffer"){
139
+
downloadImageAndSendAsBuffer(node,url,msg);
140
+
}
135
141
}
136
-
}
142
+
}
143
+
}elseif(areWeInPaginationRecursion===false){
144
+
node.warn('Instagram node has failed to fetch any media');
0 commit comments