merge
This commit is contained in:
commit
4b8da070af
1 changed files with 11 additions and 6 deletions
|
@ -1,12 +1,17 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import ox.cache
|
import re
|
||||||
from ox.cache import exists
|
from ox.cache import readUrlUnicode
|
||||||
|
|
||||||
|
|
||||||
def getPosterUrl(id):
|
def getPosterUrl(id):
|
||||||
url = "http://piratecinema.org/posters/%s/%s.jpg" % (id[:4], id)
|
url = 'http://piratecinema.org/posters/'
|
||||||
if ox.cache.exists(url):
|
html = readUrlUnicode(url)
|
||||||
return url
|
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
|
||||||
|
for result in results:
|
||||||
|
if result[1] == id:
|
||||||
|
return url + result[0]
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print getPosterUrl('0749451')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue