Joe*_*Joe 5 python web-scraping
我刚开始使用 Python,我正在尝试使用 urllib2 请求站点的 html 源代码。但是,当我尝试从站点获取 html 内容时,我没有获取完整的 html 内容 - 缺少标签。我知道当我在 firebug 中查看站点时,它们会丢失,代码会显示出来。这是由于我请求数据的方式 - 还是由于网站?如果是这样,有没有办法在 python 中获取站点的完整源代码,然后解析它?
目前我用来请求内容和我正在尝试的网站的代码是:
import urllib2
url = 'http://marinetraffic.com/ais/'
response = urllib2.urlopen(url)
html = response.read()
print(html)
Run Code Online (Sandbox Code Playgroud)
特别是 - div id="map_area" - 之间的内容缺失。非常感谢任何帮助/指示!