@@ -25,7 +25,7 @@ export class InstagramFeedBehavior {
25
25
static id = "Instagram" ;
26
26
27
27
static isMatch ( ) {
28
- return ! ! window . location . href . match ( / h t t p s : \/ \/ ( w w w \. ) ? i n s t a g r a m \. c o m \/ \w [ \w . - ] + / ) ;
28
+ return ! ! window . location . href . match ( / h t t p s : \/ \/ ( w w w \. ) ? i n s t a g r a m \. c o m \/ / ) ;
29
29
}
30
30
31
31
static init ( ) {
@@ -206,14 +206,7 @@ export class InstagramFeedBehavior {
206
206
207
207
await fetch ( window . location . href ) ;
208
208
209
- yield * this . iterSubposts ( ctx ) ;
210
-
211
- yield getState ( ctx , "Loaded Comments" , "comments" ) ;
212
-
213
- await Promise . race ( [
214
- this . iterComments ( ctx ) ,
215
- sleep ( this . maxCommentsTime )
216
- ] ) ;
209
+ yield * this . handleSinglePost ( ctx ) ;
217
210
218
211
next = xpathNode ( Q . nextPost ) ;
219
212
@@ -225,7 +218,25 @@ export class InstagramFeedBehavior {
225
218
await sleep ( waitUnit * 5 ) ;
226
219
}
227
220
221
+ async * handleSinglePost ( ctx ) {
222
+ const { getState, sleep } = ctx . Lib ;
223
+
224
+ yield * this . iterSubposts ( ctx ) ;
225
+
226
+ yield getState ( ctx , "Loaded Comments" , "comments" ) ;
227
+
228
+ await Promise . race ( [
229
+ this . iterComments ( ctx ) ,
230
+ sleep ( this . maxCommentsTime )
231
+ ] ) ;
232
+ }
233
+
228
234
async * run ( ctx ) {
235
+ if ( window . location . pathname . startsWith ( "/p/" ) ) {
236
+ yield * this . handleSinglePost ( ctx ) ;
237
+ return ;
238
+ }
239
+
229
240
const { getState, scrollIntoView, sleep, waitUnit, xpathNode } = ctx . Lib ;
230
241
//const origLoc = window.location.href;
231
242
0 commit comments