one more test
This commit is contained in:
parent
35b879b442
commit
d33455aefb
1 changed files with 5 additions and 4 deletions
|
@ -35,7 +35,7 @@ def getPosterUrl(criterionId):
|
||||||
def getMovieId(title = '', director = '', imdbId = ''):
|
def getMovieId(title = '', director = '', imdbId = ''):
|
||||||
if not imdbId:
|
if not imdbId:
|
||||||
imdbId = imdb.getMovieId(title, director)
|
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 = findRe(html, '<table cellspacing="0" id="browse-all-table">(.*?)</table>').split('<tr>')
|
||||||
strings.pop(0)
|
strings.pop(0)
|
||||||
for string in strings:
|
for string in strings:
|
||||||
|
@ -49,6 +49,10 @@ def getMovieId(title = '', director = '', imdbId = ''):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def getMovieData(title = '', director = '', imdbId = ''):
|
def getMovieData(title = '', director = '', imdbId = ''):
|
||||||
|
'''
|
||||||
|
>>> getMovieData('Le mepris', 'Jean-Luc Godard')['id']
|
||||||
|
'171'
|
||||||
|
'''
|
||||||
data = {}
|
data = {}
|
||||||
if not imdbId:
|
if not imdbId:
|
||||||
imdbId = imdb.getMovieId(title, director)
|
imdbId = imdb.getMovieId(title, director)
|
||||||
|
@ -59,6 +63,3 @@ def getMovieData(title = '', director = '', imdbId = ''):
|
||||||
data['posterUrl'] = getPosterUrl(id)
|
data['posterUrl'] = getPosterUrl(id)
|
||||||
data['synopsis'] = stripTags(findRe(html, '<h3>Synopsis</h3>(.*?)</div>'))
|
data['synopsis'] = stripTags(findRe(html, '<h3>Synopsis</h3>(.*?)</div>'))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print getMovieData('Le mepris', 'Jean-Luc Godard')
|
|
||||||
|
|
Loading…
Reference in a new issue