2010-07-07 23:25:57 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
2014-09-30 19:04:46 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2011-10-14 19:18:17 +00:00
|
|
|
import re
|
2012-08-14 13:58:05 +00:00
|
|
|
from ox.net import read_url
|
2010-07-07 23:25:57 +00:00
|
|
|
|
2012-08-15 15:15:40 +00:00
|
|
|
def get_poster_url(id):
|
2011-10-14 19:18:17 +00:00
|
|
|
url = 'http://piratecinema.org/posters/'
|
2012-08-14 13:58:05 +00:00
|
|
|
html = read_url(url, unicode=True)
|
2011-10-14 19:18:17 +00:00
|
|
|
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__':
|
2014-09-30 19:04:46 +00:00
|
|
|
print(get_poster_url('0749451'))
|
2011-10-14 19:18:17 +00:00
|
|
|
|