Comments (3)
Thanks for the report. This is happening due metascraper-audio
and metascraper-video
are using a getIframe
implementation based on JSDOM:
This implementation is simple but it isn't working fine for some that contains dynamic code execution. This error has been reported into jsdom repository: jsdom/jsdom#2346
The workaround is to provide your own getIframe
implementation. Since you are already using browserless, you can do something like this:
/* Getting iframe using browserless */
const getIframe = async (_, $, { src }) => {
const { html } = await getHTML(url, { getBrowserless: () => browserContext })
return $.load(html)
}
const metascraper = createMetascraper([
require('metascraper-video')({ getIframe }),
require('metascraper-audio')({ getIframe })
]);
Can you test at your end and tell me back? 🙂
(closing for moving away from issues but feel free to reply!)
from metascraper.
Thanks for the workaround, but it's not working.
I added your code (with a little modification)
const getIframe = async (_, $, { src }) => {
const { html } = await getHTML(src, { getBrowserless: () => browserContext })
return $.load(html)
}
const metascraper = createMetascraper([
metaAudio({getIframe}),
metaVideo({getIframe}),
]);
The src / url looks normal but i get an error, if i call the named urls (here: http://localhost:8085/https%3A%2F%2Fplayout.3qsdn.com%2Ff0e6a0f5-b8ee-11e9-8d5b-0cc47a188158)
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:637:13)
at exports.default (/app/node_modules/got/dist/source/core/utils/options-to-url.js:35:17)
at normalizeArguments (/app/node_modules/got/dist/source/core/index.js:486:51)
at got (/app/node_modules/got/dist/source/create.js:112:39)
at /app/node_modules/html-get/src/index.js:25:17
at /app/node_modules/p-cancelable/index.js:20:5
at /app/node_modules/p-cancelable/index.js:63:11
at new Promise (<anonymous>)
at new PCancelable (/app/node_modules/p-cancelable/index.js:31:19) {
input: 'favicon.ico',
code: 'ERR_INVALID_URL'
}
Node.js v18.18.2
from metascraper.
now the error is pretty different – just debug it a bit!
BTW you can resolve it against Microlink API:
Essentially it's the hosted version of this library 🙂
from metascraper.
Related Issues (20)
- provide a way to avoid re2 installation HOT 23
- Output keys not set with custom rules HOT 1
- Is there a package for grabbing just the domain? HOT 1
- Wrong Typescript declared types HOT 5
- Not scrapping the correct date HOT 1
- JSDOM dependency is not compatible with node v14 HOT 7
- Missing 'logo' in Metadata interface when using metascraper-logo plugin HOT 1
- Instagram Scraping Give me null at some field HOT 1
- Crash on `metascraper-audio` HOT 4
- Incorrect metadata types HOT 4
- Specific pages lead to crash of nodejs HOT 1
- New version causes breaks in Definitely Typed packages HOT 9
- Cannot use in Defer because of re2 HOT 1
- Add types for metascraper packages
- metascraper-date typing errors HOT 2
- [metascraper-clearbit] Typescript build error from `keyvOpts` HOT 1
- Any issues with a memory leak, particularly metascraperDescription() HOT 1
- High memory usage HOT 9
- `author` is not recognized for YouTube HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metascraper.