allmovie
This commit is contained in:
parent
47820ba939
commit
f8ba23da62
1 changed files with 26 additions and 0 deletions
26
oxweb/allmovie.py
Normal file
26
oxweb/allmovie.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
import re
|
||||
import time
|
||||
|
||||
from oxlib import stripTags, findRe
|
||||
from oxlib.cache import getUrlUnicode
|
||||
|
||||
def getMovieData(amgId):
|
||||
data = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=%s~T0" % amgId)
|
||||
r = {}
|
||||
r['poster'] = findRe(data, '<img src="(http://image.*?)"')
|
||||
r['synopsis'] = stripTags(findRe(data, 'Plot Synopsis</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
||||
r['year'] = findRe(data, '<a href="/cg/avg.dll\?p=avg&sql=24:\d{4}">(\d{4})</a>')
|
||||
r['rating'] = findRe(data, '" alt="(\d+?) Stars"')
|
||||
r['country'] = findRe(data, '<a href="/cg/avg.dll\?p=avg&sql=24:D\|\|\|206">(.*?)</')
|
||||
data = getUrlUnicode("http://www.allmovie.com/cg/avg.dll?p=avg&sql=%s~T1" % amgId)
|
||||
r['review'] = stripTags(findRe(data, 'Review</td>.*?<td colspan="2"><p>(.*?)</td>'))
|
||||
return r
|
||||
|
||||
def getMoviePoster(amgId):
|
||||
data = getMovieData(amgId)
|
||||
if data:
|
||||
return data['poster']
|
||||
return ''
|
||||
|
Loading…
Reference in a new issue