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

Pandas: Efficient way to get first row with element that is smaller than a given value
Repeat function python
Code for -Python plot
How can I use a variable value to call a dataframe?
how to post multiple value with same key in python requests?
Encryption decryption of natural language model
How to streamline using bash when always using the same tabs in a project?
Python socket.close() does not work until the script exit
Is this a Pandas bug with notnull() or a fundamental misunderstanding on my part (probably misunderstanding)
KeyError stopping App in kivy
how to run an individual test in python unittest
Pandas DataFrame fails on index but Series succeeds
balance numpy array with over-sampling
Reading in a list python [duplicate]
Adding attachments to TestCaseResults using pyral 0.9.3
Detecting and altering the time delta based on daylight savings for GMT (London)?

Categories

HOME
puzzle
facebook-graph-api
angular2-routing
decorator
deep-linking
playframework
terrain
yocto
tizen-wearable-sdk
websphere-liberty
sudo
height
flexbox
wicket
image-recognition
public-key-encryption
symfony-forms
x-frame-options
cosmicmind
phoenix
cairo
jogl
tortoisegit
sensu
url.action
kitematic
rworldmap
shopping-cart
web-frontend
pentaho-report-designer
aurelia-binding
autofill
jackson-dataformat-csv
deepstream.io
agent
brute-force
flex4.5
control-flow-graph
android-maps-v2
g1gc
taglib
python-idle
sgmlreader
shutdown
bnd
component-pascal
slot
ruby-on-rails-2
tofixed
paas
iphone-developer-program
spyne
try-finally
windows-nt
codesign
concur
xmp
bluesnap
drf-nested-routers
mogrify
gulp-livereload
epl
low-level
orientation-changes
symfony-2.6
candidate-key
adcolony
genetic-programming
outline
facebook-wall
broadcasting
healthvault
facebook-chat
cling
gamepad
.net-cf-3.5
ng-hide
javascriptmvc
grunt-contrib-compass
adomd.net
shiva3d
database-permissions
vt100
zend-framework-modules
tridion2009
marmalade-edk
macruby
noir
for-xml-path
rijndael
asp.net-routing
hardware-acceleration
usergroups
dotproject

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