one more test

This commit is contained in:
Rolux 2008-07-25 14:15:55 +02:00
parent 35b879b442
commit d33455aefb

View file

@ -35,7 +35,7 @@ def getPosterUrl(criterionId):
def getMovieId(title = '', director = '', imdbId = ''):
if not imdbId:
imdbId = imdb.getMovieId(title, director)
html = getUrlUnicode('http://criterion.com/asp/list.asp?sort=spine', timeout = -1)
html = getUrlUnicode('http://criterion.com/asp/list.asp?sort=spine', timeout = 86400)
strings = findRe(html, '<table cellspacing="0" id="browse-all-table">(.*?)</table>').split('<tr>')
strings.pop(0)
for string in strings:
@ -49,6 +49,10 @@ def getMovieId(title = '', director = '', imdbId = ''):
return ''
def getMovieData(title = '', director = '', imdbId = ''):
'''
>>> getMovieData('Le mepris', 'Jean-Luc Godard')['id']
'171'
'''
data = {}
if not imdbId:
imdbId = imdb.getMovieId(title, director)
@ -59,6 +63,3 @@ def getMovieData(title = '', director = '', imdbId = ''):
data['posterUrl'] = getPosterUrl(id)
data['synopsis'] = stripTags(findRe(html, '<h3>Synopsis</h3>(.*?)</div>'))
return data
if __name__ == '__main__':
print getMovieData('Le mepris', 'Jean-Luc Godard')