Compare commits

..

No commits in common. "11376c5d7d9e2d9bf96627104a188499f62bc5ce" and "926b8ad2550a6bcde54bbd8f421172969f4b16a6" have entirely different histories.

2 changed files with 5 additions and 4 deletions

View file

@ -95,7 +95,7 @@ def tokenize(source):
'.', ',', ';' '.', ',', ';'
] ]
REGEXP = 'abcdefghijklmnopqrstuvwxyz' REGEXP = 'abcdefghijklmnopqrstuvwxyz'
STRING = '\'"`' STRING = '\'"'
WHITESPACE = ' \t' WHITESPACE = ' \t'
def is_regexp(): def is_regexp():
# checks if a forward slash is the beginning of a regexp, # checks if a forward slash is the beginning of a regexp,

View file

@ -36,7 +36,7 @@ def delete_url(url, data=None, headers=cache.DEFAULT_HEADERS):
cache.store.delete(url, data, headers) cache.store.delete(url, data, headers)
def get_url(id): def get_url(id):
return "http://www.imdb.com/title/tt%s/" % id return "http://akas.imdb.com/title/tt%s/" % id
def reference_section(id): def reference_section(id):
@ -334,6 +334,7 @@ class Imdb(SiteParser):
return self._cache[url] return self._cache[url]
def __init__(self, id, timeout=-1): def __init__(self, id, timeout=-1):
# use akas.imdb.com to always get original title:
# http://www.imdb.com/help/show_leaf?titlelanguagedisplay # http://www.imdb.com/help/show_leaf?titlelanguagedisplay
self.baseUrl = "http://www.imdb.com/title/tt%s/" % id self.baseUrl = "http://www.imdb.com/title/tt%s/" % id
super(Imdb, self).__init__(timeout) super(Imdb, self).__init__(timeout)
@ -627,7 +628,7 @@ def get_movie_by_title(title, timeout=-1):
except: except:
params['q'] = params['q'].encode('utf-8') params['q'] = params['q'].encode('utf-8')
params = urlencode(params) params = urlencode(params)
url = "http://www.imdb.com/find?" + params url = "http://akas.imdb.com/find?" + params
data = read_url(url, timeout=timeout, unicode=True) data = read_url(url, timeout=timeout, unicode=True)
#if search results in redirect, get id of current page #if search results in redirect, get id of current page
r = '<meta property="og:url" content="http://www.imdb.com/title/tt(\d+)/" />' r = '<meta property="og:url" content="http://www.imdb.com/title/tt(\d+)/" />'
@ -704,7 +705,7 @@ def get_movie_id(title, director='', year='', timeout=-1):
except: except:
params['q'] = params['q'].encode('utf-8') params['q'] = params['q'].encode('utf-8')
params = urlencode(params) params = urlencode(params)
url = "http://www.imdb.com/find?" + params url = "http://akas.imdb.com/find?" + params
#print url #print url
data = read_url(url, timeout=timeout, unicode=True) data = read_url(url, timeout=timeout, unicode=True)