2017-03-09 5 views
0

HTML DOMの構文解析ツールを使用して、あるページから別のページへのリンクを削りたい。DOMからのHTMLとJSのスクレイプ

$('#vidabc-fast-watch-button').click(function() { 
    $('#fast-watch-frame').attr('src','http://vidabc.com/embed-8fyiakzp0ob8.html'); 
});      
$('#kingvid-fast-watch-button').click(function() { 

    $('#vidwatch-fast-watch-button').click(function() { 
    $('#fast-watch-frame').attr('src',''); 
    }); 
    $('#estream-fast-watch-button').click(function() { 
    $('#fast-watch-frame').attr('src','http://estream.to/embed-2605th4kkypl.html'); 
    }); 
    $('#openload-fast-watch-button').click(function() { 
    $('#fast-watch-frame').attr('src','http://openload.co/embed/YsaOx8K5Bk0/'); 
    }); 

私は別のPHPページとpreg_match URLに情報をこすりしたい:

他のWebページでは、このコードを持っています。 JSコード内にリンクが見つかりませんでした。

答えて

0

あなたはscriptタグのテキストの内容を見て、スクリプト内のURLと一致し、その上にpreg_match_allを起動できます。

$scr = $doc->getElementsByTagName('script')[0]->textContent; 
preg_match_all("/http:[\w#\[\]@!$&()*+,;=%:\/.?~-]*/", $scr, $urls); 

print_r($urls[0]); 

を与え例えば、これは希望出力:

Array 
(
    [0] => http://vidabc.com/embed-8fyiakzp0ob8.html 
    [1] => http://estream.to/embed-2605th4kkypl.html 
    [2] => http://openload.co/embed/YsaOx8K5Bk0/ 
) 

実行してくださいeval.in