2010-07-08 01:25:57 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
2014-09-30 21:04:46 +02:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2011-10-14 21:18:17 +02:00
|
|
|
import re
|
2012-08-14 15:58:05 +02:00
|
|
|
from ox.net import read_url
|
2010-07-08 01:25:57 +02:00
|
|
|
|
2012-08-15 17:15:40 +02:00
|
|
|
def get_poster_url(id):
|
2011-10-14 21:18:17 +02:00
|
|
|
url = 'http://piratecinema.org/posters/'
|
2012-08-14 15:58:05 +02:00
|
|
|
html = read_url(url, unicode=True)
|
2011-10-14 21:18:17 +02:00
|
|
|
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
|
|
|
|
for result in results:
|
|
|
|
if result[1] == id:
|
|
|
|
return url + result[0]
|
2010-07-08 01:25:57 +02:00
|
|
|
return ''
|
|
|
|
|
2011-10-14 21:18:17 +02:00
|
|
|
if __name__ == '__main__':
|
2014-09-30 21:04:46 +02:00
|
|
|
print(get_poster_url('0749451'))
|
2011-10-14 21:18:17 +02:00
|
|
|
|