mycognitive / xgoogle Goto Github PK
View Code? Open in Web Editor NEWThis project forked from pkrumins/xgoogle
Python wrapper to Google Search service.
Home Page: http://www.catonmat.net/blog/python-library-for-google-search/
This project forked from pkrumins/xgoogle
Python wrapper to Google Search service.
Home Page: http://www.catonmat.net/blog/python-library-for-google-search/
$ ./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
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:
Line 289 in d80a4c1
Is this a known issue?
Thanks
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?
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 ""
This commented code make some variables undefined. It should be investigated if it is dead code or not.
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)
Improve, test and fix GeneralSearch branch.
Pull: #1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.