node-ytdl-core: No longer works in browserify after "refactor: use `URL` object to parse urls"

Until recently I have been able to Browserify ytdl-core so that it works in a browser (I patch miniget to use a proxy mechanism to make fetches from Youtube or else they would be blocked by CORS)

The refactor: use URL object to parse urls change broke things because URL is called Url when require (‘url’) is invoked in a browser (as opposed to node) environment. Also the browser doesnt have a searchParams property.

I have patched these things and it works again in the browser.

I know this is not an anticipated use case - but I thought you might like to know.

Martin

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 25 (9 by maintainers)

Most upvoted comments

🎉 This issue has been resolved in version 4.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

You can also use a CORS proxy (such as AllOrigins) to bypass CORS restrictions without the need for an extension.

Hello again Thanks again for the rollup.js suggestion. Update - I thought I’d got rollup to work but it looks like I was fooled by a cached file. The output of rollup is way too small. Martin