title: How can I use beautiful soup to get the current price of a stock on Google Finance?
body: <p>I have the following python code and the goal is to get the current price of this stock, which is $110.80. </p>
  
  <pre><code>import urlparse
  import urllib2
  import pdb
  from bs4 import BeautifulSoup
  from pprint import pprint
  
  url = "https://www.google.com.hk/finance?q=0001&amp;ei=yF14VYC4F4Wd0ASb64CoCw"
  
  def WebCrawl(url):
      htmltext = urllib2.urlopen(url).read()
      soup = BeautifulSoup(htmltext)
      P = soup.find()
      print P
  
  WebCrawl(url)
  </code></pre>
  
  <p>Now when I print <code>soup</code>, the number 110.80 actually appears in multiple places, for example: </p>
  
  <p><code>{u:"/finance?q=HKG:0001",name:"0001",cp:"-1.07",p:"110.80",cid:"164573760542896"}</code></p>
  
  <p>and </p>
  
  <p><code>&lt;span id="ref_164573760542896_l"&gt;110.80&lt;/span&gt;</code></p>
  
  <p>and</p>
  
  <p><code>&lt;meta content="110.80" itemprop="price"/&gt;</code></p>
  
  <p><strong>First question</strong>: what is the right place within the html text to look for current price of this stock, since it seems like the price occurs in multiple areas within the html text ?</p>
  
  <p><strong>Second Question</strong>: what should I put in the <code>soup.find()</code> or <code>soup.find_all()</code> field <strong>such that I can obtain the current price of this particular stock</strong>. Can someone help me out here please ? </p>