diff --git a/ox/form.py b/ox/form.py index faa1551..5358afb 100644 --- a/ox/form.py +++ b/ox/form.py @@ -5,8 +5,7 @@ from __future__ import print_function import itertools import mimetypes -import os -import hashlib +import random import sys from six import PY2 @@ -21,7 +20,8 @@ _fmt = '%%0%dd' % _width def _make_boundary(): # Craft a random boundary. - boundary = ('=' * 15) + hashlib.sha1(os.urandom(32)).hexdigest() + '==' + token = random.randrange(sys.maxsize) + boundary = ('=' * 15) + (_fmt % token) + '==' return boundary class MultiPartForm(object): diff --git a/ox/web/imdb.py b/ox/web/imdb.py index b63dc69..c766ecf 100644 --- a/ox/web/imdb.py +++ b/ox/web/imdb.py @@ -27,52 +27,6 @@ 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': [ - '
(.*?)',
+ 'summary': {
+ 'page': 'plotsummary',
+ 're': ' (.*?)<\/p>',
'type': 'string'
},
- 'producer': reference_section('producers'),
- 'productionCompany': {
- 'page': 'reference',
+ 'posterId': {
+ 'page': 'combined',
+ 're': '',
+ lambda data: data.split('Series Crew')[0],
+ 'Produced by(.*?)',
+ '(.*?)'
+ ],
+ 'type': 'list'
+ },
+ 'productionCompany': {
+ 'page': 'combined',
+ 're': [
+ 'Production Companies
(.*?)
',
'(.*?)'
],
'type': 'list'
},
'rating': {
- 'page': 'reference',
- 're': [
- '',
- 'ipl-rating-star__rating">([\d,.]+?)',
- ],
+ 'page': 'combined',
+ 're': '