From d963f1888a912fa219b7c84e2d425d6ebd72822f Mon Sep 17 00:00:00 2001 From: Rolux Date: Fri, 25 Jul 2008 16:06:50 +0200 Subject: [PATCH] allmovie: parseList function --- oxweb/allmovie.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/oxweb/allmovie.py b/oxweb/allmovie.py index a124f1f..978125d 100644 --- a/oxweb/allmovie.py +++ b/oxweb/allmovie.py @@ -15,9 +15,9 @@ def getMovieData(allmovieId): data['rating'] = findRe(html, '" alt="(\d+?) Stars"') data['country'] = findRe(html, '(.*?)(.*?)')).split(', ') - data['genre'] = map(lambda x: stripTags(x), findRe(html, 'Genre / Type(.*?)').split('
  • ')) - data['keywords'] = map(lambda x: stripTags(x), findRe(html, 'Keywords(.*?)').split('
  • ')) - data['themes'] = map(lambda x: stripTags(x), findRe(html, 'Themes(.*?)').split('
  • ')) + data['genre'] = parseList(html, 'Genre / Type') + data['keywords'] = parseList(html, 'Keywords') + data['themes'] = parseList(html, 'Themes') html = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:%s~T1" % allmovieId) data['review'] = stripTags(findRe(html, 'Review.*?

    (.*?)')) return data @@ -28,6 +28,9 @@ def getMoviePoster(allmovieId): return data['poster'] return '' +def parseList(html, title): + return map(lambda x: stripTags(x), findRe(html, '%s(.*?)' % title).split('

  • ')) + if __name__ == '__main__': print getMovieData('177524')