我现在正在制作一个网络爬虫。
从 HTML 中获取链接很容易,但从 javascript 的结果中获取链接对我来说并不容易。
我可以得到 javascript 的结果以便知道链接的引用位置吗?
例如。
如何从 Python 中的 javascript 代码中检索到 google.com 的链接?
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<a href="#" id="goog">to google</a>
</body>
<script>
document.getElementById('goog').onclick = function() {
window.location = "http://google.com";
};
</script>
</html>