Como puedo extraer de una pagina html el contenido de "file" o "sources" de un tag <script>
el cual está así:
<div class="show_div" style="width:100%;">
<div class="video" style="margin:0px auto;" itemscope itemtype="http://schema.org/VideoObject">
<div id="standout" style="margin:0 auto; padding-top:10px; padding-bottom:10px; position:relative; z-index:40;">
<div id="home_video"></div>
<script>
var secs = 0;
var lastp = 0;
var runc = 0;
jwplayer.key = "; var playerInstance = jwplayer("
home_video ").setup({"
autostart ": false,"
controls ": true,"
flashplayer ": " / jwplayer7 / jwplayer.flash.swf ","
image ": "
https ": //700FFVQAUKB92L3IVDQB6.jpg", ga: {}, "mute": false, "ph": 1, "preload": "none", "primary": "html", "repeat": false, "skin": {
"name": "tu"
}, "stagevideo": true, "stretching": "uniform", "visualplaylist": true, "width": "100%", "aspectratio": "16:9", "provider": 'http', "startparam": "start", tracks: [{
"file": "",
"kind": "thumbnails"
}], "sources": [{"file": "Dato que requiero","label": "480p"},
{"file": "Dato que requiero","label": "720p"}, "Dato que requiero"],
"logo": {
"logoBar": "",
"target": "blank",
"link": ""
}, "displaydescription": false, "displaytitle": false, "abouttext": "", "aboutlink": ""
});
playerInstance.on('ready', function() {
jwLogoBar.addLogo(playerInstance);
});
playerInstance.on('time', function(event) {
if (runc === 0) {
var time = Math.floor(event.position);
if (time > lastp + 10) {
if (lastp != time) {
lastp = time;
$.getJSON("/?c=l&i=FFVQ9XIBKA&o=3807c0ff49a4b8d7d9cd9ae6b415857e&a=" + canRunAds, function(data) {
if (data.status == 1) {
runc = 1;
}
});
}
}
}
});
</script>
</div>
</div>
</div>
El tag no tiene "id" o "class", pero es el único que cuenta con la palabra "visualplaylist" en toda la página e intenté hacerlo con el siguiente código:
<?php
include_once('./simple_html_dom.php');
$html = file_get_html( $url );
$file = $html->find('script');
foreach ($file as $vid) {
if(strpos ($v->innertext, 'visualplaylist') !== false) {
$script = $vid;
}
}
print_r($script);
?>
Este no funciona (no cuento con mucho conocimiento) ¿Podrían ayudarme? Gracias.