Google search scrapper , Python
<p>I am new to Python and trying to make a Google search scrapper for the purpose of getting stock prices , but I run my code below I dont get any results instead I am getting the page HTML formatting.</p>

<pre><code>import urllib.request
from bs4 import BeautifulSoup

import requests

url = 'https://www.google.com/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=uwti'
response = requests.get(url)
html = response.content

soup = BeautifulSoup(html, "html.parser")

print(soup.prettify())
</code></pre>

<p>Am I missing something very simple , please give me some pointers on this . I am trying to extract the current stock value.How do I extract this value in the attached image ?</p>

<p><a href="https://i.stack.imgur.com/BSfxl.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/BSfxl.jpg" alt="enter image description here"></a></p>

<p>It is in the source when you right-click and choose view-source in your browser. You just need to change the <em>url</em> slightly and pass a <em>user-agent</em> to match what you see there using requests:</p>

<pre><code>In [2]: from bs4 import BeautifulSoup
   ...: import requests
   ...: 
   ...: url = 'https://www.google.com/search?q=uwti&amp;rct=j'
   ...: response = requests.get(url, headers={
   ...:     "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (K
   ...: HTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"})
   ...: html = response.content
   ...: 
   ...: soup = BeautifulSoup(html, "html.parser")
   ...: print(soup.select_one("span._Rnb.fmob_pr.fac-l").text)
   ...: 
27.51
</code></pre>

<p><code>soup.find("span", class_="_Rnb fmob_pr fac-l").text</code> would also work and is the correct way to look for a tag using the <em>css classes</em> with find or <em>find_all</em></p>

<p>You can see in chrome when you use <a href="https://www.google.com/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=uwti" rel="nofollow">https://www.google.com/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=uwti</a>, there is a redirect to <a href="https://www.google.com/search?q=uwti&amp;rct=j" rel="nofollow">https://www.google.com/search?q=uwti&amp;rct=j</a>:</p>

<p><a href="https://i.stack.imgur.com/uEeoM.png" rel="nofollow"><img src="https://i.stack.imgur.com/uEeoM.png" alt="enter image description here"></a></p>

python parsing beautifulsoup urllib