@@ -14,7 +14,7 @@ const Q = {
1414 commentMoreComments : "./following-sibling::div/div/div[2][@role='button'][./span/span]" ,
1515 viewComments : ".//h4/..//div[@role='button']" ,
1616 photoCommentList : "//ul[../h2]" ,
17- firstPhotoThumbnail : "//div[@role='main']/ /div[3]//div[contains(@style, 'border-radius')]/ /div[contains(@style, 'max-width') and contains(@style, 'min-width')]//a[@role='link'] " ,
17+ firstPhotoThumbnail : "//*[@id=\"mount_0_0_4m\"]/div /div[1]/div/div[ 3]/div /div/div/div[1]/div[1] /div/div/div[4]/div/div/div/div/div/div/div/div/div[3]/div[1]/div[1]/div/div/a " ,
1818 firstVideoThumbnail : "//div[@role='main']//div[contains(@style, 'z-index')]/following-sibling::div/div/div/div[last()]//a[contains(@href, '/videos/') and @aria-hidden!='true']" ,
1919 firstVideoSimple : "//div[@role='main']//a[contains(@href, '/videos/') and @aria-hidden!='true']" ,
2020 mainVideo : "//div[@data-pagelet='root']//div[@role='dialog']//div[@role='main']//video" ,
@@ -275,6 +275,7 @@ export class FacebookTimelineBehavior {
275275 firstPhoto . click ( ) ;
276276 await sleep ( waitUnit * 5 ) ;
277277 await waitUntil ( ( ) => window . location . href !== lastHref , waitUnit * 2 ) ;
278+ const firstPhotoHref = window . location . href ;
278279
279280 let nextSlideButton = null ;
280281
@@ -290,7 +291,8 @@ export class FacebookTimelineBehavior {
290291 sleep ( 3000 )
291292 ] ) ;
292293
293- if ( window . location . href === lastHref ) {
294+ // Exit once we've looped
295+ if ( window . location . href === firstPhotoHref ) {
294296 break ;
295297 }
296298
0 commit comments