[RELEASE] Googlejson - Python interface for google searches
#1
This is a release for addon developers, not XBMC end users.
Get it from the Github repo
https://github.com/icefilms-xbmc/googlejson

I've written a module that uses google's JSON api, to provide fast access to google searches.
It returns unicode etc. Its better than parsing html of a google search which is slow, especially if you want many results.

This is set to be used in Videofalcon, but i thought i'd share it, as it is very very useful in creating search functions for sites in xbmc.

you can pump the search to search only urls beginning with the site url
you can even do
site = 'my_site.com/the-thing-that-prefixes-tv-show-urls'
to only return tvshow results
ie. do
site = 'http://tvshack.bz/tv/overview'
if tv show urls are
http://tvshack.bz/tv/overview/4DWB2S6P

With a little more innovation you can make it even more specific.
Like filter the results by only displaying results that contain perfect matches of the searchterm in the title, or contain 'Episode List' etc. You can use re.search to do this, but you'll want to make sure that the re.IGNORECASE flag is set.

I recommend you do something like this in your addon:
(using the commonly used addDir function)

PHP Code:
import googlejson

lulz 
googlejson.doSearch('for teh lulz',2,3,site='ohinternet.com')
if 
lulz:
    for 
page in lulz:
      for 
i in page:
        
addDir (i['titleNoFormatting'],i['url'],mode)
if 
not lulz:
    print 
'no results found' 


For more documentation view the README on the Github page.
Reply
#2
bump. this is really useful, i hope addon coders see it.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
[RELEASE] Googlejson - Python interface for google searches00