我正试图从NSE网站上获取进展/下降-https://www1.nseindia.com/live_market/dynaContent/live_market.htm
预付款/预付款以表格格式显示在HTML中。但我无法检索网站上显示的实际数值
from bs4 import BeautifulSoup
import pandas as pd
import requests
url = "https://www1.nseindia.com/live_market/dynaContent/live_market.htm"
webpage = requests.get(url);
soup = BeautifulSoup(webpage.content, "html.parser");
for tr in soup.find_all('tr'):
advance = tr.find_all('td')
print(advance)
我只能得到一个空值或无值。我不确定我做错了什么。当我检查网站中的元素时,我看到了数值978904,但在Spyder中,这些元素中的值用连字符显示。有人能帮忙吗
此页面使用
JavaScript
加载这些信息,但requests
/BeautifulSoup
无法运行JavaScript
使用
DevTools
在Chrome
/Firefox
(tabNetwork
,filterxhr
)中,我发现JavaScript
使用的url将其作为JSON
数据加载,所以我甚至不必使用BeautifulSoup
来获取它顺便说一句:没有
User-Agent
它不会发送数据相关问题 更多 >
编程相关推荐