So I'm trying to get data from my script tag HTML with cheerio
here is my scripttag.html :
<html>
<head>
<script type="text/javascript">
var playerInstance=jwplayer('smthing');
playerInstance.setup(
{
title : '',
tracks: [{
file: '',
kind: 'captions',
'default': true
}],
sources: [{'file':'vidurl','type':'video/mp4'}],
image: "imageurl",
captions:
{
color:'#FFFF00',fontSize:17,backgroundOpacity:50
},
}
);
</script>
</head>
</html>
Im using Cheerio To load the html but... how do i really get the vidurl ?
here is my index.js:
const html = ("the scripttag.html")
const cheerio = require("cheerio");
let $ = cheerio.load(html)
const scripttag = $.html("head > script")
const title = ...
const srcfiles = ...
const image = ...
Now I got the script tag, but how do I get the
const title from playerintance.setup -> title
const srcfiles from playerinstance.setup -> sources -> file
const image from playerinstance.setup -> image