[英]DOM HTML & JS scrape from JS part
我想使用HTML DOM相位器抓取從一個頁面到另一頁面的鏈接。
另一個網頁具有以下代碼:
$('#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。 但是找不到JS代碼內部的鏈接。
任何想法?
您可以通過查看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
運行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.