diff --git a/oxweb/movieposterdb.py b/oxweb/movieposterdb.py
index 5dc6d68..85ee172 100644
--- a/oxweb/movieposterdb.py
+++ b/oxweb/movieposterdb.py
@@ -10,6 +10,8 @@ def getData(id):
'''
>>> getData('0060304')['posters'][0]
u'http://www.movieposterdb.com/posters/06_03/1967/0060304/l_99688_0060304_639fdd1e.jpg'
+ >>> getData('0123456')['posters']
+ []
'''
data = {
"url": getUrl(id)
@@ -20,17 +22,18 @@ def getData(id):
def getId(url):
return url.split("/")[-2]
-def getPostersByUrl(url):
+def getPostersByUrl(url, group=True):
posters = []
html = getUrlUnicode(url)
- if not "The movie you requested is not found" in html:
- results = re.compile('', re.DOTALL).findall(html)
- for result in results:
- posters += getPostersByUrl(result)
- results = re.compile('', re.DOTALL).findall(html)
+ if url in html:
+ if group:
+ results = re.compile('', re.DOTALL).findall(html)
+ for result in results:
+ posters += getPostersByUrl(result, False)
+ results = re.compile('', re.DOTALL).findall(html)
for result in results:
html = getUrlUnicode(result)
- posters.append(findRe(html, '"(http://www.movieposterdb.com/posters/.*?\.jpg)"'))
+ posters.append(findRe(html, '"(http://www.movieposterdb.com/posters/.+?\.jpg)"'))
return posters
def getUrl(id):