more allmovie data; allmovie id is 123456, not 1:123456
This commit is contained in:
parent
73aeef5106
commit
392ca2939b
1 changed files with 12 additions and 5 deletions
|
@ -6,21 +6,28 @@ import time
|
||||||
from oxlib import stripTags, findRe
|
from oxlib import stripTags, findRe
|
||||||
from oxlib.cache import getUrlUnicode
|
from oxlib.cache import getUrlUnicode
|
||||||
|
|
||||||
def getMovieData(amgId):
|
def getMovieData(allmovieId):
|
||||||
html = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=%s~T0" % amgId)
|
html = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:%s~T0" % allmovieId)
|
||||||
data = {}
|
data = {}
|
||||||
data['poster'] = findRe(html, '<img src="(http://image.*?)"')
|
data['poster'] = findRe(html, '<img src="(http://image.*?)"')
|
||||||
data['synopsis'] = stripTags(findRe(html, 'Plot Synopsis</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
data['synopsis'] = stripTags(findRe(html, 'Plot Synopsis</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
||||||
data['year'] = findRe(html, '<a href="/cg/avg.dll\?p=avg&sql=24:\d{4}">(\d{4})</a>')
|
data['year'] = findRe(html, '<a href="/cg/avg.dll\?p=avg&sql=24:\d{4}">(\d{4})</a>')
|
||||||
data['rating'] = findRe(html, '" alt="(\d+?) Stars"')
|
data['rating'] = findRe(html, '" alt="(\d+?) Stars"')
|
||||||
data['country'] = findRe(html, '<a href="/cg/avg.dll\?p=avg&sql=24:D\|\|\|206">(.*?)</')
|
data['country'] = findRe(html, '<a href="/cg/avg.dll\?p=avg&sql=24:D\|\|\|206">(.*?)</')
|
||||||
html = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=%s~T1" % amgId)
|
data['director'] = stripTags(findRe(html, '<td class="formed-sub"><a href="/cg/avg.dll\?p=avg&sql=2:\d+">(.*?)</td>')).split(', ')
|
||||||
|
data['genre'] = map(lambda x: stripTags(x), findRe(html, '<span>Genre / Type</span>(.*?)</table>').split('</li><li>'))
|
||||||
|
data['keywords'] = map(lambda x: stripTags(x), findRe(html, '<span>Keywords</span>(.*?)</table>').split('</li><li>'))
|
||||||
|
data['themes'] = map(lambda x: stripTags(x), findRe(html, '<span>Themes</span>(.*?)</table>').split('</li><li>'))
|
||||||
|
html = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:%s~T1" % allmovieId)
|
||||||
data['review'] = stripTags(findRe(html, 'Review</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
data['review'] = stripTags(findRe(html, 'Review</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def getMoviePoster(amgId):
|
def getMoviePoster(allmovieId):
|
||||||
data = getMovieData(amgId)
|
data = getMovieData(allmovieId)
|
||||||
if data:
|
if data:
|
||||||
return data['poster']
|
return data['poster']
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print getMovieData('177524')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue