Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

face image, image and video search added #14

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
This file contains people who have helped xgoogle project:

* Nikola Milosevic
Thanks for adding:
* Face image search
* Holger Berndt
Thanks for adding:
* 'lang' and 'tld' arguments to Google Search
Expand Down
17 changes: 17 additions & 0 deletions examples/ImageExample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This program does a Google search for face images for "quick and dirty" and returns
# 50 results.
#

from xgoogle.search import GoogleFaceImageSearch, SearchError
try:
gs = GoogleFaceImageSearch("Eddard Stark")
gs.results_per_page = 50
results = gs.get_results()
for res in results:
print res.trumb.encode('utf8')
print res.url.encode('utf8')
print
except SearchError, e:
print "Search failed: %s" % e

17 changes: 17 additions & 0 deletions examples/ImageExample2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This program does a Google search for images for "quick and dirty" and returns
# 50 results.
#

from xgoogle.search import GoogleImageSearch, SearchError
try:
gs = GoogleImageSearch("quick and dirty")
gs.results_per_page = 50
results = gs.get_results()
for res in results:
print res.trumb.encode('utf8')
print res.url.encode('utf8')
print
except SearchError, e:
print "Search failed: %s" % e

3 changes: 2 additions & 1 deletion examples/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

from xgoogle.search import GoogleSearch, SearchError
try:
gs = GoogleSearch("quick and dirty")
gs = GoogleSearch("game of thrones season 3")
gs.results_per_page = 50
results = gs.get_results()
for res in results:
print res.title.encode('utf8')
print res.desc.encode('utf8')
print res.excerpt.encode('utf8')
print res.url.encode('utf8')
print
except SearchError, e:
Expand Down
21 changes: 21 additions & 0 deletions examples/exampleVideoSearch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This program does a Google search for video for "Iron Maiden" and returns
# 50 results. Video search requires NLTK. For instruction on installation please visit http://www.nltk.org/install.html
#

from xgoogle.search import GoogleVideoSearch, SearchError
try:
gs = GoogleVideoSearch("Iron Maiden")
gs.results_per_page = 50
results = gs.get_results()
for res in results:
print 'Name: ' + res.name.encode('utf8')
print 'URL: ' + res.url.encode('utf8')
print 'Date: ' + res.date.encode('utf8')
print 'Duration: ' + res.duration.encode('utf8')
print 'Author: ' + res.author.encode('utf8')
print 'Description: ' + res.description.encode('utf8')
print
except SearchError, e:
print "Search failed: %s" % e

14 changes: 8 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
This is a Google library called 'xgoogle'. Current version is 1.3.
This is a fork of a Google library called 'xgoogle'. Current version is 1.4

It's written by Peteris Krumins ([email protected]).
His blog is at http://www.catonmat.net -- good coders code, great reuse.
It is forked by Nikola Milosevic ([email protected]) from the original code that was written by Peteris Krumins ([email protected]).
Peteris Krumins blog is at http://www.catonmat.net -- good coders code, great reuse.
Nikola Milosevic's blog is at http://www.inspiratron.org.

This fork adds Google face image search, and hopefully in the future Google image search

The code is licensed under MIT license.

Expand Down Expand Up @@ -187,13 +190,12 @@ v1.1: * added Google Sponsored Links Search.
v1.2: * added Google Sets module
v1.3: * added Google Translate module
* fixed a bug in browser.py when KeyboardInterrupt did not get propagated.
v1.4: * added Google image and face image search
* added Google video search (requires NLTK, for install instruction see http://www.nltk.org/install.html)

--------------------------------------------------------------------------

That's it. Have fun! :)


Sincerely,
Peteris Krumins
http://www.catonmat.net

7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import sys

__version__ = '1.3'
__version__ = '1.4'

import os
def _read(fname):
Expand All @@ -14,8 +14,8 @@ def _read(fname):
long_description=_read('readme.txt'),
classifiers=[],
keywords='google search',
author='Peteris Krumins',
author_email='[email protected]',
author='Peteris Krumins, Nikola Milosevic',
author_email='[email protected]',
url='http://github.com/pkrumins/xgoogle',
license='MIT',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
Expand All @@ -25,6 +25,7 @@ def _read(fname):
include_package_data=True,
zip_safe=False,
install_requires=[
'nltk==2.0.4'
# -*- Extra requirements: -*-
],
)
Loading