Exemplo n.º 1
0
def search_wikipedia(query):
    """Query Wikipedia and show the top hit"""
    gs = GoogleSearch("site:wikipedia.com %s" % query)
    print gs.top_result()['titleNoFormatting']
    print gs.top_url()
    return gs.top_url()
Exemplo n.º 2
0
def url_search(query, lucky=True):
    gs = GoogleSearch(query)
    try:
        return [gs.top_url()] if lucky else gs.top_urls()
    except ProxyError:
        raise ValueError