diff --git a/ox/form.py b/ox/form.py index 5358afb..faa1551 100644 --- a/ox/form.py +++ b/ox/form.py @@ -5,7 +5,8 @@ from __future__ import print_function import itertools import mimetypes -import random +import os +import hashlib import sys from six import PY2 @@ -20,8 +21,7 @@ _fmt = '%%0%dd' % _width def _make_boundary(): # Craft a random boundary. - token = random.randrange(sys.maxsize) - boundary = ('=' * 15) + (_fmt % token) + '==' + boundary = ('=' * 15) + hashlib.sha1(os.urandom(32)).hexdigest() + '==' return boundary class MultiPartForm(object): diff --git a/ox/web/imdb.py b/ox/web/imdb.py index c766ecf..b63dc69 100644 --- a/ox/web/imdb.py +++ b/ox/web/imdb.py @@ -27,6 +27,52 @@ def read_url(url, data=None, headers=cache.DEFAULT_HEADERS, timeout=cache.cache_ def get_url(id): return "http://www.imdb.com/title/tt%s/" % id + +def reference_section(id): + return { + 'page': 'reference', + 're': [ + '
(.*?)<\/p>', - 'type': 'string' - }, + 'summary': zebra_table('Plot Summary', more=[ + '
(.*?)',
+ 'page': 'reference',
+ 're': '(.*?)
',
+ 'Production Companies.*?',
'(.*?)'
],
'type': 'list'
},
'rating': {
- 'page': 'combined',
- 're': '