0

I'm new to node.js and puppeteer and I was trying to find a way to scroll to the end of a playlist to scrape song names and artists. I've tried the top answer from this question: Puppeteer - scroll down until you can't anymore

which worked for a site like google but was ineffective for spotify. I've tried code like window.scrollBy() but I have a hunch that the scrollbar is created from javascript and I can't think of a way to display more of the playlist.

here's an example playlist that lazy loads https://open.spotify.com/playlist/37i9dQZF1DWWQRwui0ExPn

1 Answers1

0

I'm new to node as well but I think with mouse.move you should get something

mouse wheel options - puppeteer

(the code is from the doc)

await page.goto('https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366');

const elem = await page.$('div');
const boundingBox = await elem.boundingBox();
await page.mouse.move(
  boundingBox.x + boundingBox.width / 2,
  boundingBox.y + boundingBox.height / 2
);

await page.mouse.wheel({ deltaY: -100 })

Never used it yet but it's definitely worth the try.