i try to learn this 4 hours
but im stuck in this random website.
how to get the video from this. (note: this website provide direct download link, so maybe its fine to use this website as example)
https://indoxxi.net/film-seri/stranger-things-season-2-2017-1fhos2/play
because, there is no way to get specific dom element except whole html. So i decide to use simple html dom parser.
after page loaded, i run several script on web console
$('video').attr('src');
undefined
$("[id='ep-1072070']").click()
[a#ep-1072070.btn-eps.active, prevObject: init(1), context: document, selector: "[id='ep-1072070']"]
$('video').attr('src');
"https://lh3.googleusercontent.com/wpbYsMBx7WHFrm_jSjZQrQVlPLusRF0njilMpyTlbg_YVNSffjfufAWht5_kvJu4BUDJRpWkeuw=m22"
from information above. we know that there is not any
ok. lets do this with MTS
==============
header.php
<?php
ini_set('max_execution_time', 120);
require_once "/var/www/html/test/MTS/MTS/EnableMTS.php";
require_once "advanced_html_dom.php"; //same as PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/manual.htm
$url = "https://indoxxi.net/film-seri/stranger-things-season-2-2017-1fhos2/play";
//MTS begin
$windowObj = \MTS\Factories::getDevices()->getLocalHost()->getBrowser('phantomjs')->getNewWindow($url);
$windowObj->setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0");
$wait = "function wait5() {
setTimeout(function(){}, 5000);
return 'wait 5sec';
}";
$windowObj->loadJS($wait);
$selector = "[id='ep-1072070']";
$exists = $windowObj->getSelectorExists($selector);
test1.php
<?php
require('header.php');
if($exists)
{
//using clickElement
$windowObj->clickElement($selector);
echo $windowObj->callJSFunction("wait5") ."<br>";
sleep(5);
$dom = $windowObj->getDom();
$html = str_get_html($dom); //from simple dom html parser
var_dump($html->find('video')->outertext); //still empty
}
test2.php
<?php
require('header.php');
if($exists)
{
//using leftclick
$windowObj->mouseEventOnElement($selector, 'leftclick');
echo $windowObj->callJSFunction("wait5") ."<br>";
sleep(5);
$dom = $windowObj->getDom();
$html = str_get_html($dom); //from simple dom html parser
var_dump($html->find('video')->outertext); //still empty
}
test3.php
<?php
require('header.php');
if($exists)
{
//using callJSFunction
$scriptData = "function myHelloWorld() {
loadEpisode(0,1072070);
return 'script loaded';
}"; //we get loadEpisode() from onclick property in $selector
$windowObj->loadJS($scriptData);
echo $windowObj->callJSFunction("myHelloWorld") ."<br>";
echo $windowObj->callJSFunction("wait5") ."<br>";
sleep(5);
$dom = $windowObj->getDom();
$html = str_get_html($dom); //from simple dom html parser
var_dump($html->find('video')->outertext); //still empty
}
but all i get is NULL. :(
how i can get that video src using MTS?
thanks .
sry for my long post. but i really struggle to know about this