简体   繁体   English

使用Python和Beautiful Soup解析HTML时,jsl标记未显示

[英]jsl tag doesn't show up when parsing HTML with Python and Beautiful Soup

A little background (I am super novice at programming, so bear with me): 一些背景知识(我是编程的超级新手,所以请多多包涵):

I am trying to scrape duration_in_traffic numbers from google maps (I know there is an API, but this data piece is restricted to 'Maps for Business' so I figured this would be the easiest route). 我正在尝试从Google地图中抓取duration_in_traffic数字(我知道有一个API,但是此数据段仅限于“ Maps for Business”,因此我认为这是最简单的路线)。

When I use Beautiful Soup to find all the <div> tags, hardly anything shows up. 当我使用Beautiful Soup查找所有<div>标签时,几乎没有显示任何内容。 After inspecting the element a bit closer, it looks like the majority of the page is nested under a tag that looks like: 在仔细检查了元素之后,看起来页面的大部分嵌套在一个标签下,该标签如下:

<jsl jstcache="79"></jsl>

I'm assuming this has something to do with the javascript and the dynamic nature of the page, but is there even a way to access the divisions under this jsl tag using Beautiful Soup? 我假设这与javascript和页面的动态性质有关,但是甚至还可以使用Beautiful Soup来访问此jsl标签下的分区吗?

If Beautifulsoup can't do it, I can recommend lxml.html [0] 如果Beautifulsoup无法做到,我可以推荐lxml.html [0]

[0] http://lxml.de/lxmlhtml.html [0] http://lxml.de/lxmlhtml.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM