Reputation: 657
http://finance.daum.net/item/main.daum?code=052400
** This is a Korean finance web portal, which shows stock information for a Korean company named "Kona i"
I'm a beginner, just started learning web scraping with Python. I was trying to scrape the price of this stock using BS. In the web page, the tag and the class of the stock price was em, "curPrice up" respectively. So I put "em.curPrice up" in the selector part. And when I printed it, only to come up with an empty list. What is the problem with it?
price = requests.get("http://finance.daum.net/item/main.daum?code=052400")
html = bs(price.text, "lxml")
current_price = html.select("em.curPrice up")
Upvotes: 0
Views: 60
Reputation: 4930
The element you're looking for in the html appears to be this.
<em class="curPrice up">19,450</em>
An html selector of em.curPrice up
will match an <em>
with a class of curPrice, then find a child element <up>
You should modify the selector to em.curPrice.up
Upvotes: 1