Giter Site home page Giter Site logo

compleat's Introduction

compleat

Fetch autocomplete suggestions from Google Search. Use responsibly. Not affiliated with Google.

Installation

pip install compleat

Usage

compleat can be used as either a Python library or command-line tool.

Library

>>> import compleat
>>> q = compleat.suggest("is allen iverson ")
>>> q.meta
{
    'lang': 'en',
    'query': 'is allen iverson ',
    'uid': '2c83d58b7350a9f55066cf4f49d16fd9',
    'timestamp': 'Fri Jan 31 00:13:00 2014'
}
>>> len(q.suggestions)
20
>>> q.suggestions[0:5]
[{'relevance': 800,
  'text': u'is allen iverson broke',
  'title': u'',
  'type': u'QUERY'},
 {'relevance': 601,
  'text': u'is allen iverson really broke',
  'title': u'',
  'type': u'QUERY'},
 {'relevance': 600,
  'text': u'is allen iverson still broke',
  'title': u'',
  'type': u'QUERY'},
 {'relevance': 566,
  'text': u'is allen iverson still in the nba',
  'title': u'',
  'type': u'QUERY'},
 {'relevance': 565,
  'text': u'is allen iverson back in the nba',
  'title': u'',
  'type': u'QUERY'}]

Note: compleat.suggest() also accepts an optional lang parameter, which is "en" (English) by default.

>>> import compleat
>>> [ s["text"] for s in compleat.suggest("bon", lang="en").suggestions[:5] ]
['bones', 'bonnie and clyde', 'bonobos', 'bon appetit', 'bonefish grill']
>>> [ s["text"] for s in compleat.suggest("bon", lang="fr").suggestions[:5] ]
['bon coin', 'bonobo', 'bon prix', 'bon patron', 'bonnet']
>>> [ s["text"] for s in compleat.suggest("bon", lang="es").suggestions[:5] ]
['bonoloto', 'bonus', 'bon jovi', 'bones', 'bonsai']

Command-line tool

Run compleat -h from the command line for full set of options. Examples:

compleat -q "where is "

compleat -q "where is " --json

compleat -q "where is " --db sqlite:///whereis.sqlite

compleat -q "who is " "why is " "where is "

compleat --template "is {} " -q "allen iverson" "marie curie" "meryl streep"

compleat's People

Contributors

jsvine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.