SORU
1 Kasım 2009, Pazar


Google Python Uygulaması Arama

Python uygulaması google arama sorgusu çalıştırmak için çalışıyorum. Herhangi bir python arayüzü var mı? Eğer değil ise yok herkes Google biliyor mu API bana bunu sağlayacak. Teşekkürler

CEVAP
1 Kasım 2009, Pazar


Basit bir örnek var here (acayip bazı alıntılar eksik;-). En çok ne göreceğini web Python arayüzleri için eski, durdurulan SOAP API-örnek işaret ettiğim için kullandığı yeni ve desteklenen AJAX API, bu kesinlikle bir tane istiyorum!-)

Editburada daha tamamlanması gereken tırnak &c ile örnek bir Python 2.6;-)...:

#!/usr/bin/python
import json
import urllib

def showsome(searchfor):
  query = urllib.urlencode({'q': searchfor})
  url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % query
  search_response = urllib.urlopen(url)
  search_results = search_response.read()
  results = json.loads(search_results)
  data = results['responseData']
  print 'Total results: %s' % data['cursor']['estimatedResultCount']
  hits = data['results']
  print 'Top %d hits:' % len(hits)
  for h in hits: print ' ', h['url']
  print 'For more results, see %s' % data['cursor']['moreResultsUrl']

showsome('ermanno olmi')

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • bobinire

    bobinire

    24 EYLÜL 2006
  • Glove and Boots

    Glove and Bo

    1 ŞUBAT 2007
  • LinusTechTips

    LinusTechTip

    25 Kasım 2008