python-ox/ox/web/piratecinema.py

18 lines
438 B
Python
Raw Normal View History

2010-07-07 23:25:57 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2011-10-14 19:18:17 +00:00
import re
from ox.cache import readUrlUnicode
2010-07-07 23:25:57 +00:00
def getPosterUrl(id):
2011-10-14 19:18:17 +00:00
url = 'http://piratecinema.org/posters/'
html = readUrlUnicode(url)
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
for result in results:
if result[1] == id:
return url + result[0]
2010-07-07 23:25:57 +00:00
return ''
2011-10-14 19:18:17 +00:00
if __name__ == '__main__':
print getPosterUrl('0749451')