python


How to read and map the description of the google search result using python request ?


I used python requests to find the google search result. I'm able to find the links and descriptions but how can I map the links with its respective description.
Below is the code and its output:
req=urllib2.Request('http://www.google.com/search?hl=en&safe=off&q='+'cat')
sock=urllib2.urlopen(req)
data = sock.read()
soup = BeautifulSoup(data, 'lxml')
if(soup):
links = soup.findAll('cite')
spans = soup.find_all("span", {"class": "st"})
for link, span in ((l,s) for l in links for s in spans):
print link.text, span.get_text()
Output:
https://en.wikipedia.org/wiki/Cat, The domestic cat (Latin: Felis catus) is a small, typically furry, carnivorous mammal. They are often called house cats when kept as indoor pets or simply cats
https://en.wikipedia.org/wiki/Cat, A non-profit organisation, run entirely by volunteers who want to improve the welfare of stray cats in Singapore.
https://en.wikipedia.org/wiki/Cat, Manufacturer of construction and mining equipment, diesel and natural gas engines, industrial gas turbines, and a wide offering of related services.
www.catwelfare.org/,The domestic cat (Latin: Felis catus) is a small, typically furry, carnivorous mammal. They are often called house cats when kept as indoor pets or simply cats
www.catwelfare.org/, A non-profit organisation, run entirely by volunteers who want to improve the welfare of stray cats in Singapore.
www.catwelfare.org/, Manufacturer of construction and mining equipment, diesel and natural gas engines, industrial gas turbines, and a wide offering of related services.
etc..
The same link is mapped with all the description of the google search result.
The required output is,
https://en.wikipedia.org/wiki/Cat, The domestic cat (Latin: Felis catus) is a small, typically furry, carnivorous mammal. They are often called house cats when kept as indoor pets or simply cats
www.catwelfare.org/, A non-profit organisation, run entirely by volunteers who want to improve the welfare of stray cats in Singapore.
www.cat.com/,Manufacturer of construction and mining equipment, diesel and natural gas engines, industrial gas turbines, and a wide offering of related services.
Kindly help me to resolve this.

Related Links

Setting all dictionary elements to 0 python
Translate curl to python [duplicate]
Setting Values Of Inherited Properties
How do I make pip install binaries to a writable path?
TensorFlow: generating a random constant
How can I organize my functions to get something like class.draw.line() instead of class.drawLine
Traceback (most recent call last): (works in trinket.io but not 3.4/2.7.11)
python : Mode of a List
How to send and receive data from flask?
Python HTTPS Login to account to scrape data, is this bad practice?
Celery, redis and ConnectionPool
Numpy Choose Elements from 2 arrays
Selenium Python iterate over a table of rows it is stopping at the first row
How to add a variable of a method of a class in aonther program in python?
Django : Getting error while removing django.contrib.sites from INSTALLED_APPS
Can I scrape a html page which is local machine using scrapy?

Categories

HOME
cil
answer-set-programming
oauth
warnings
puppet
wms
laravel-5.2
angular2-directives
h2
csvhelper
rfc
azureservicebus
webdav
data-science-experience
openwrt
netflix-feign
click
powershell-v3.0
google-shopping
cs-cart
scala-native
aspell
zoomcharts
linq-to-sql
plupload
cvs2svn
sonarqube-msbuild-runner
marathon
sql-update
cruisecontrol.net
dspic
profile
npm-install
switching
guile
version-numbering
cortex-m3
dhtmlx-scheduler
smart-mobile-studio
idl
hawtio
ocs
mms
rhel.net
readfile
coreclr
jquery-multidatespicker
pytest-django
matlab-cvst
asmx
prototypejs
vcf
nsjsonserialization
production-environment
amazon-machine-learning
livefyre
gauss
mcrypt
scd
fontconfig
infinite-scroll
visual-studio-templates
lotus
shinyjs
garrys-mod
gulp-typescript
payu
debugdiag
dts
django-filer
shipitjs
inotifypropertychanged
faraday
dac
inet
anti-cheat
mirrorlink
wikitext
windowlistener
built-in
webhdfs
hiera
sysfs
pgagent
gmaps4rails
errorprovider
ember-addon
funkload
httpcontext
android-json-rpc
healthvault
gamepad
va-list
javascriptmvc
multiple-conditions
xml-libxml
lync-server-2010
javascriptserializer
xgettext
caliper
unions
galaxy-tab
dcpu-16
pantheios
front-controller
plinq
lazy-c++

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App