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

How to get bash output over ssh via Paramiko
how to read the pop server response in python
How to read .cap files other than Pyshark that is faster than Scapy's rdpcap ()?
Flask-SQLAlchemy many to many
Python - archiving file before moving to another directory? [duplicate]
How to reverse the order of letters in a string in python [closed]
How to combine two join(()) statement into one?
How to 'reduce' repetitions in a list
Evaluating a function over a lattice of unknown dimension using meshgrid and vectorize
Add img with a variable src in django
python: coloring regex matches
Python: Finding Relation between substrings of a string
Where does the turtle (and its screen) appear in scipy/anaconda/spyder (2.7)?
Can Python's AsyncIO be used within an existing web application?
Xvfb PyQt5 Xlib: extension “RANDR” missing on display
matplotlib plot creation very slow on a headless server

Categories

HOME
sharepoint
xbox-live
vhdl
vb6
amazon-swf
jsviews
vs-team-services
transparent
zend-framework2
appmaker
gspread
currency
cpanel
dlib
opera-mini
mule-studio
derived
autolayout
scalaz7
url.action
facebook4j
tarantool
net-snmp
websauna
devforce
vegan
svnkit
fabric-digits
nunit-3.0
swagger-editor
strstr
concrete5-5.7
fltk
agent
visualstudio.testtools
scalafx
estimation
lumen-5.3
ogre3d
slot
mcrypt
pagefile
in-memory-database
pycurl
mercury
sqlexception
sqldatareader
build-process
iostat
alter
vst
linkageerror
gherkin
spatial-query
aerogear
git-rebase
affix
lmfit
rad
jericho-html-parser
android-snackbar
risk-analysis
on-duplicate-key
pgm
isml
em
data-generation
late-static-binding
mailcore
fortran77
xml-libxml
phpsh
attachevent
enumerators
legacy-code
expression-evaluation
getstring
gjs
ubuntu-11.04
authenticode
ets
nvelocity
post-redirect-get
winverifytrust
asp.net-mvc-controller
integer-promotion
act
method-signature
interface-design





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