Giter Site home page Giter Site logo

Comments (3)

Kikobeats avatar Kikobeats commented on August 31, 2024

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.

spgonejoker avatar spgonejoker commented on August 31, 2024

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.

Kikobeats avatar Kikobeats commented on August 31, 2024

now the error is pretty different – just debug it a bit!

BTW you can resolve it against Microlink API:

https://api.microlink.io/?url=https://playout.3qsdn.com/f0e6a0f5-b8ee-11e9-8d5b-0cc47a188158&audio&video

Essentially it's the hosted version of this library 🙂

from metascraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.