openmedialibrary_platform/Shared/lib/python3.7/site-packages/ox/web/piratecinema.py

20 lines
482 B
Python
Raw Normal View History

2013-10-11 17:28:32 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2014-09-30 16:15:32 +00:00
from __future__ import print_function
2013-10-11 17:28:32 +00:00
import re
from ox.net import read_url
def get_poster_url(id):
url = 'http://piratecinema.org/posters/'
html = read_url(url, unicode=True)
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
for result in results:
if result[1] == id:
return url + result[0]
return ''
if __name__ == '__main__':
2014-09-30 16:15:32 +00:00
print(get_poster_url('0749451'))
2013-10-11 17:28:32 +00:00