pull/26/merge
Niels Abels 4 years ago committed by GitHub
commit 8accb85849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -346,7 +346,11 @@ func (s *Session) setFirstItem(ctx context.Context) error {
func navToEnd(ctx context.Context) error {
// try jumping to the end of the page. detect we are there and have stopped
// moving when two consecutive screenshots are identical.
// a minimum floor of duplicate screenshots is used to overcome any
// any false positives in determining the end of some larger libraries
var previousScr, scr []byte
minAmountOfDuplicateScr := 3
amountOfDuplicateScr := 0
for {
chromedp.KeyEvent(kb.PageDown).Do(ctx)
chromedp.KeyEvent(kb.End).Do(ctx)
@ -356,7 +360,15 @@ func navToEnd(ctx context.Context) error {
continue
}
if bytes.Equal(previousScr, scr) {
break
amountOfDuplicateScr++
if *verboseFlag {
log.Printf("Screen is equal to previous screen, waiting to hit threshold [%v/%v]", amountOfDuplicateScr, minAmountOfDuplicateScr)
}
if amountOfDuplicateScr == minAmountOfDuplicateScr {
break
}
} else {
amountOfDuplicateScr = 0
}
previousScr = scr
time.Sleep(tick)

Loading…
Cancel
Save