如何在视频中找到src属性

  • 本文关键字:src 属性 视频 node.js
  • 更新时间 :
  • 英文 :


我正在使用axios和cheerio,我想在视频标签中抓取src

如果我只是像$('img')一样抓取img标签,它会显示关于这些标签的所有属性。

但如果我像$('video')一样抓取视频标签,它只显示{}(空对象..(

如何在视频标签中抓取src?

axios.get(url)
.then(res => {
const html = res.data.;
const $ = cheerio.load(html);
const text = $('#playerArea video');
console.log(text);  // never show me any attribute..
});

试试

const text = $("#playerArea").attr("src");
console.log(text);  // never show me any attribute..

getAttribute((对我有用。

const videoElem = elem.querySelector('.video-class').getAttribute('attribute-name');

或者你的例子。。

const text = div.querySelector('.rmc_dummy_container').getAttribute('src');

将输出(base64编码(src(来自Or Assayag的评论(

最新更新