[Vuejs]-How to go to an URL , search fro an specific class in the boddy and copy its "src"?

0👍

You can search for the video html tag in the html document and then get the value of src as following:

const videoNode = document.querySelector("video");
const videoSource = videoNode.src;
console.log("video source: ", videoSource);

If your video is embedded in an iframe element then you can use the following query:

const iframeNode = document.querySelector("iframe");
const videoNode = iframeNode.contentWindow.document.body.querySelector('video');
const videoSource = videoNode.src;
console.log("video source: ", videoSource);

PS: You can’t access an with different origin using JavaScript due to same-origin policy.

Leave a comment