【问题标题】:I want to scrape last price from nseindia but getting "--" this [duplicate]我想从 nseindia 获取最新价格,但得到“--”这个 [重复]
【发布时间】:2020-04-24 15:06:49
【问题描述】:
**import requests**
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0'}
url ="https://www1.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp? 
symbol=SBIN&illiquid=0&smeFlag=0&itpFlag=0"
response = requests.get(url,headers=headers)
soup = BeautifulSoup(response.text,'lxml')
price = soup.find_all('ul',{'class':'stock'})[0].find('span').text
print(price)

--

[![在此处输入图片描述][1]][1]

[1]:https://i.stack.imgur.com/oSzfO.png强文本

【问题讨论】:

  • 用户 API,而不是从网站解析某些内容。
  • 嘿,我有一个问题,如何从答案中显示的网站获取动态 json 链接。!

标签: python beautifulsoup


【解决方案1】:

这是一个有趣的 API 方法。似乎有从 NSE India 获取数据的库。

https://nsepy.readthedocs.io/en/latest/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-07
    • 1970-01-01
    • 2021-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多