GithubHelp home page GithubHelp logo

mycognitive / xgoogle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pkrumins/xgoogle

8.0 4.0 10.0 200 KB

Python wrapper to Google Search service.

Home Page: http://www.catonmat.net/blog/python-library-for-google-search/

Python 100.00%
google-search python-library

xgoogle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xgoogle's Issues

SyntaxError: invalid syntax in /xgoogle/search.py, line 124

$ ./google_dl.py 
Traceback (most recent call last):
  File "./google_dl.py", line 11, in <module>
    from xgoogle.search import GoogleSearch, SearchError
  File "/usr/local/lib/python3.2/dist-packages/xgoogle-1.4-py3.2.egg/xgoogle/search.py", line 124
    self._re_search_strings = ("Ergebnisse", "von", u"ungefähr")
                                                               ^
SyntaxError: invalid syntax

Searches returning no results

Hi,

I recently came back to using xgoogle for a project and noticed that all of my searches were returning no results. I fixed the issue by changing line 289 in search.py to take a list of tags, i.e. results = soup.findAll(["div", "g"]) instead of the current line 289:

results = soup.findAll('div','g')

Is this a known issue?

Thanks

Python 2 Branch Blank Output

pip3 install git+ssh://[email protected]/mycognitive/xgoogle
Successfully installed xgoogle-1.4

pip install git+ssh://[email protected]/mycognitive/xgoogle@python2
Successfully installed nltk-2.0.4 xgoogle-1.4

seeker.py

from xgoogle.search import GoogleSearch
gs = GoogleSearch("quantum mechanics")
gs.results_per_page = 3
results = gs.get_results()
for res in results:
    print (res.title.encode("utf8"))
    print (res.url.encode("utf8"))

python3 seeker.py

b'Quantum mechanics - Wikipedia, the free encyclopedia'
b'https://en.wikipedia.org/wiki/Quantum_mechanics'
b'Introduction to quantum mechanics - Wikipedia, the free encyclopedia'
b'https://en.wikipedia.org/wiki/Introduction_to_quantum_mechanics'
b'News for quantum mechanics'
b'/search?q=quantum+mechanics&num=3&sa=G&hl=en&prmd=ivnslb&source=univ&tbm=nws&tbo=u&ved=0ahUKEwjimO7chpzPAhUOxmMKHQJqDBoQqAIIJw'

python seeker.py

No errors.  No output.

Any ideas?

NameError: name 'name2codepoint' is not defined

Downloading 'b'somefile'' from 'b'http://www.example.com/somefile'' into ....
Error: Reading socket timed out, try again later.

Traceback (most recent call last):
  File "google_dl", line 161, in <module>
    for results in page:
  File "google_dl", line 79, in __next__
    results = self.gs.get_results()
  File "~/.python/xgoogle/search.py", line 201, in get_results
    results = self._extract_results(page)
  File "~/.python/xgoogle/search.py", line 288, in _extract_results
    eres = self._extract_result(result)
  File "~/.python/xgoogle/search.py", line 295, in _extract_result
    title, url = self._extract_title_url(result)
  File "~/.python/xgoogle/search.py", line 309, in _extract_title_url
    title = self._html_unescape(title)
  File "~/.python/xgoogle/search.py", line 369, in _html_unescape
    return re.sub(r'&([^;]+);', entity_replacer, s, re.U)
  File "~/anaconda/lib/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "~/.python/xgoogle/search.py", line 356, in entity_replacer
    if entity in name2codepoint:
NameError: name 'name2codepoint' is not defined

Example command using google_dl utility:

google_dl -s http://www.marquette.edu/maqom/ -f pdf ""

Google search operators

Is it possibe use Google Search Operator in request?

Ex.: gs = GoogleSearch("inurl: query")
Gives me same result as inurl query request by web site... (colon is missed)

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.