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

python script is not executed via crontab
Pandas dataframe.to_csv() returns each row in quotes
Avoiding Stack Overflow in Python 3. Advice needed
ld cannot find .so libraries
Converting multi-line String to Dict in Python
passing structure from c++ to python
MySQL string replace using SQLAlchemy
How to copy an image from server directory to another directory in python
Python Selenium click on a specific row in a table containing the right data in a column
How to run different methods on strings through a variable?
Why does order of comparison matter for this apply/lambda inequality?
python returning to the default statement
How can 2 objects be considered not equal and not identicial by Python, but have the same id?
No post request after submitting a form when I want to download a PDF
How to divide some csv files into two parts, and then merge them as an csv file in python
Can't popen new instance of python.exe

Categories

HOME
xbox-live
makefile
batch-processing
filterrific
wsdl
bing
ocaml
youtube-livestreaming-api
cocos2d-x-3.0
hyperledger-fabric
tizen-wearable-sdk
browserify
onenote-api
goutte
ipfs
vuex
gatsby
ctypes
react-leaflet
postmessage
line-api
multiple-monitors
scaling
jquery-terminal
factor-analysis
atlassian-plugin-sdk
movies
marathon
rails-activerecord
google-maps-android-api-2
bootstrap-typeahead
fabric
sumo
continuous-deployment
vegan
ifstream
coreclr
issue-tracking
topic-modeling
freetts
web-development-server
code-composer
rkt
scalafx
facebook-chatbot
bids
email-parsing
ajp
w3-total-cache
taskmanager
amazon-machine-learning
istorage
dwarf
pluck
openh264
info
pycurl
autoresize
efxclipse
svn-merge
chessboard.js
update-site
mailcatcher
brackets-shell
insertion-sort
java.util.calendar
wikitext
mysqldumpslow
python-winshell
js-cookie
twython
manjaro
ibm-data-studio
word-2013
x-ua-compatible
cg
docopt
sthttprequest
bullet
indexing-service
reserved-words
sanitization
logentries
osx-snow-leopard
nscolor
execvp
stagefright
vmware-server
windows-update
google-closure-library
dwolla
fraud-prevention
pep8
wpdb
zend-framework-modules
socketstream
tfs-power-tools
pstree
getstring
hobo
hashalgorithm
nsindexpath
paintcomponent
opengl-es-lighting
adsl
ets
soft-keyboard
outlook-form

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