1
我正在尝试在Google地图中获取section-facts-description-text
。如何在Google Maps中使用python获取section-facts-description-text?
我曾经尝试这样的代码已经:
import urllib
from bs4 import BeautifulSoup
url = "https://www.google.co.id/maps/place/Semarang,+Kota+Semarang,+Jawa+Tengah/@-7.0247703,110.3488077,12z/data=!3m1!4b1!4m5!3m4!1s0x2e708b4d3f0d024d:0x1e0432b9da5cb9f2!8m2!3d-7.0051453!4d110.4381254"
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html,"html.parser")
# kill all script and style elements
for script in soup(["script", "style"]):
script.extract() # rip it out
# get text
text = soup.get_text()
for strong_tag in soup.find_all('span',{'class':'section-facts-description-text'}):
print strong_tag.text, strong_tag.next_sibling
这有什么错我的代码?有什么我失踪?是否有任何选项可以在python中使用库或API来执行该操作?