PHP / XPath - >试图在对象中刮取param name =“flashvars”,但没有结果

时间:2015-07-26 13:02:18

标签: php xpath

尝试从该网站上删除视频文件:http://startv.com.tr/dizi/kiralik-ask/bolumler/sayfa/1/kiralik-ask-6-bolum

之前我曾经抓过几个网站,但是这个网站的所有视频详细信息都属于'flashvars'属性。我尝试了以下代码,但无济于事:

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$cl = curl_exec($ch);

$dom = new DOMDocument();
@$dom->loadHTML($cl);
$xpath = new DOMXPath($dom);

$titleQuery = $xpath->query("//object[@id='player_api']/param[@name='flashvars']/@value");

$title = $titleQuery->item(0);

有人可以对此有所了解吗?似乎没有输出...我只需输出以下内容,以便我可以提取网址:

config={"key":"#$b7fea7222fcf06cf04b","canvas":{"backgroundColor":"#000000","backgroundGradient":"none","width":940},"clip":{"url":"http://startv.motiwecdn.com/startv/_definst_/mp4:startv/StarTV/Dizi/kiralikask/kiralikask6.mp4/manifest.f4m?e11b3501178b61b39327ddbaf0f1382abd05b815ab421995479746cc8000af6026681846e829f8353f49a7d2fb99ce29%26v%3D1","referanceID":"","PublisherId":"","provider":"dygprovider","scaling":"fit","test":"deneme","urlResolvers":null,"usePartition":1,"splitVideo":1,"partDuration":"20","currentPart":"1","nextPartCallBack":"changeParts","autoPlay":false,"forceAutoPlay":true,"live":null,"nextVideo":null,"suggestion":null,"adLib":[{"time":420,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FMID%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":-1,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FPOST%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":20,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D480x70%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FOVER%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":0,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FPRE%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true}],"start":"0","duration":"0"},"play":{"opacity":1,"replayLabel":null,"label":null},"contextMenu":[{"Video URL’ini Al":"function()"},{"Geçerli Zamandaki Video URL’ini Al":"function()"},"DYG Player 1.0"],"plugins":{"dygprovider":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.dyg-video-provider-1.0.0.swf?12"},"f4m":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.f4m-3.2.10.swf?11v1s1"},"smil":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.smil-3.2.9.swf?v1"},"httpstreaming":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.httpstreaming-3.2.11.swf?31212321v111"},"hddn":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.rtmp-3.2.13.swf?v1"},"bwcheck":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.bwcheck_httpstreaming-3.2.13.swf?1221v111","dynamic":true,"rememberBitrate":true,"bitrateProfileName":"startv","qos":{"frames":false,"screen":false},"netConnectionUrl":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flashlsFlowPlayer-0.4.0.7.swf?1","checkOnStart":true},"controls":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.controls-3.2.16.swf?11c1vs11"},"ima":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.ima-2.0.0.swf?1233x","test":"deneme2"},"comscore":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.comscore-1.0.0.swf?21","nameTag":"startv"},"partition":{"url":"http://img-dygassets.mncdn.com/player2/plugins/flowplayer/flowplayer.partition-1.0.00.swf?v11","buttons":{"overColor":"#ff0000"},"part":{"description":"index.php?part=","shareWindow":"_self"}}},"playerId":"player","playlist":[{"url":"http://startv.motiwecdn.com/startv/_definst_/mp4:startv/StarTV/Dizi/kiralikask/kiralikask6.mp4/manifest.f4m?e11b3501178b61b39327ddbaf0f1382abd05b815ab421995479746cc8000af6026681846e829f8353f49a7d2fb99ce29%26v%3D1","referanceID":"","PublisherId":"","provider":"dygprovider","scaling":"fit","test":"deneme","urlResolvers":null,"usePartition":1,"splitVideo":1,"partDuration":"20","currentPart":"1","nextPartCallBack":"changeParts","autoPlay":false,"forceAutoPlay":true,"live":null,"nextVideo":null,"suggestion":null,"adLib":[{"time":420,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FMID%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":-1,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FPOST%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":20,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D480x70%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FOVER%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true},{"time":0,"adURL":"https%3A%2F%2Fpubads.g.doubleclick.net%2Fgampad%2Fads%3Fsz%3D640x480%26iu%3D%2F37011203%2FWeb%2FStarTV%2FDiziler%2FPRE%26ciu_szs%26impl%3Ds%26gdfp_req%3D1%26env%3Dvp%26output%3Dxml_vast3%26unviewed_position_start%3D1%26url%3D%5Breferrer_url%5D%26description_url%3D%5Bdescription_url%5D%26correlator%3D1437913302143%26cust_params%3Dstar_cat%253D1410%2526playerType%253DflashPlayer%26ad_rule%3D0","useSkip":true}],"start":"0","duration":"0"}]}

提前致谢!

1 个答案:

答案 0 :(得分:0)

问题不是object元素,而是使用JavaScript动态创建的。如果您在浏览器中打开网址并查看来源,则根本找不到视频对象。您可以使用无头浏览器来实际执行JS,或者更好地检查在站点上创建的AJAX请求并找出对象的生成方式。