我正在使用Python 3,我正在尝试从一个网站检索数据。但是,这些数据是动态加载的,我现在拥有的代码不起作用:url = eveCentralBaseURL + str(mineral)
print("URL : %s" % url);
response = request.urlopen(url)
data = str(response.read(10000))
data = data.replace("\\n", "\n")
print(data)
当我试图找到一个特定的值时,我会找到一个模板,例如“{{formatPrice median}”而不是“4.48”。
我如何才能使它使我可以检索值而不是占位符文本?
编辑:This是我试图从中提取信息的特定页面。我正在尝试获取“中值”值,它使用模板{{formatPrice median}
编辑2:我已经安装并设置了使用Selenium和美化组的程序。
我现在的代码是:from bs4 import BeautifulSoup
from selenium import webdriver
#...
driver = webdriver.Firefox()
driver.get(url)
html = driver.page_source
soup = BeautifulSoup(html)
print "Finding..."
for tag in soup.find_all('formatPrice median'):
print tag.text
Here是程序执行时的屏幕截图。不幸的是,它似乎没有找到任何指定了“formatPrice中值”的内容。