Skip to content

minor changes to make it work on my machine - #5

Open
o-Oscar wants to merge 1 commit into
zsrobinson:mainfrom
o-Oscar:main
Open

minor changes to make it work on my machine#5
o-Oscar wants to merge 1 commit into
zsrobinson:mainfrom
o-Oscar:main

Conversation

@o-Oscar

@o-Oscar o-Oscar commented Jul 10, 2025

Copy link
Copy Markdown

I needed to add the code in order to make the app function properly :

  • click on the "accept cookies" button to make the scrolling work with puppeteer
  • add the --no-sandbox and --disable-setuid-sandbox to the args to the puppeteer.launch

Was able to download https://musescore.com/user/59704117/scores/17288323 on my machine.

Hope it helps !

Comment thread lib/extract-resources.ts
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
await page.goto(url, { waitUntil: "domcontentloaded" });
page.on('console', msg => console.log(msg.text()));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only needed for efficient debug on my part

Comment thread lib/extract-resources.ts
await new Promise((r) => setTimeout(r, 500)); // wait ig?

await page.waitForSelector('#accept-btn')
await page.click('#accept-btn');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two lines needed in order to pass the "accept cookies" stage

Comment thread lib/extract-resources.ts
let otherPages: string[] = [];
for (let i = 0; i < totalPages - 1; i++) {
await page.mouse.wheel({ deltaY: 1185 });
for (let i = 0; i < totalPages*2; i++) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't quite understand the scrolling logic. With this settings it should be able to handle very long and very short scores equally well without skipping any pages

Comment thread lib/generate.ts
const browser = await puppeteer.launch();
const browser = await puppeteer.launch({
args: [
'--no-sandbox', '--disable-setuid-sandbox']

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to make it work on my machine

@zsrobinson

Copy link
Copy Markdown
Owner

Hey there, thanks for contributing!

I think that the cookie pop-up might be a regional thing, since I don't get any sort of pop-up here in the United States, but switching on my VPN to France, I was able to see the pop-up you're talking about (at least when using Safari, I think Firefox blocks this by default). I still think something weird might be going on because I wasn't able to replicate the issue you're having with scroll behavior not working, even through the VPN to France.

Unfortunately, the added page.waitForSelector call in this PR makes the website time-out when musescore does not display this cookie pop-up. I'm sure there's another way that we could click this accept button when there is a pop-up that doesn't break it for when there's not. I'm not sure if I'll be able to get to this myself since it's hard for me to replicate the issue, though maybe some more debugging is needed. (as a note to myself for future debugging when I have time, it might be good to clear the puppeteer cache)

Despite this, I'm glad you were able to find the tool helpful and were able to get it working for you!

@zsrobinson zsrobinson added the bug Something isn't working label Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants