【发布时间】:2016-02-15 19:36:30
【问题描述】:
我正在尝试检索某个网站的 youtube 链接。但是当使用简单的 html DOM 解析器时,它无法找到我正在寻找的链接。
$new_html = file_get_html("https://www.bia2.com/video/Amir-Shamloo/Delam-Tange/");
foreach ($new_html->find('href') as $youtube) {
echo $youtube;
}
它应该会找到链接:https://www.youtube.com/watch?v=vJ2aNG0aJPU。
有人知道这里有什么问题吗?
【问题讨论】:
-
该 youtube 链接似乎没有出现在源代码中。
-
这也可能因为无效的html而失败
-
如果是嵌入式视频,它可能会使用这样的链接:youtube.com/embed/vJ2aNG0aJPU not the watch?v= version。
标签: php html simple-html-dom