In the link provided above, the very first result is the video link to the youtube, I want to access the link provided. How can I do that in python?
EDIT: My input will be a string that I query in the google-search box. Like in this case "black sabbath iron man"
Best How To :
Scraping HTML is fragile -- yes you can do it with beautifulsoup4, e.g
soup = bs4.BeautifulSoup(html_string)
href = soup.find('h3').find('a').get('href')
will show /url?q=http://www.youtube.com/watch%3Fv%3D9LjbMVXj0F8&sa=U&ei=ESCPVPD6NcT3yQS-04C4DA&ved=0CBQQtwIwAA&usg=AFQjCNGV1u7FshGW4K_Ffu0zLzwaW7sCzw or the like. However, the slightest cosmetic change to Youtube search results might break your application.
Better to register your app with Google and use the provided API, as per Google's own docs. The Python client library nicely supports App Engine, see https://developers.google.com/youtube/v3/code_samples/python_appengine for example.