old_contents: import urllib, urllib2
  try:
      import simplejson as json
  except ImportError:
      try:
          import json
      except ImportError:
          raise ImportError
  import datetime
  from bson.objectid import ObjectId
  from werkzeug import Response
  
  UA = 'Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.9) Gecko/20100913 Firefox/3.6.9'
  
  def scrape(url):
      urllib.quote(url.encode('utf-8'))
      req = urllib2.Request(url=url,
                            headers={'User-Agent': UA})
      hdl = urllib2.urlopen(req)
      html = hdl.read()
      return html
  
  
  class MongoJsonEncoder(json.JSONEncoder):
      def default(self, obj):
          if isinstance(obj, (datetime.datetime, datetime.date)):
              return obj.isoformat()
          elif isinstance(obj, ObjectId):
              return unicode(obj)
          return json.JSONEncoder.default(self, obj)
  
  def jsonify(*args, **kwargs):
      """ jsonify with support for MongoDB ObjectId
      """
      return Response(json.dumps(dict(*args, **kwargs), cls=MongoJsonEncoder), mimetype='application/json')
  
  def canonicalize(title, year):
      return title.lower().strip() + '-' + year.lower().strip()
  
new_contents: import urllib, urllib2
  try:
      import simplejson as json
  except ImportError:
      try:
          import json
      except ImportError:
          raise ImportError
  import datetime
  from bson.objectid import ObjectId
  from werkzeug import Response
  
  UA = 'Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.9) Gecko/20100913 Firefox/3.6.9'
  
  def scrape(url):
      urllib.quote(url.encode('utf-8'))
      req = urllib2.Request(url=url,
                            headers={'User-Agent': UA})
      hdl = urllib2.urlopen(req)
      html = hdl.read()
      return html
  
  
  class MongoJsonEncoder(json.JSONEncoder):
      def default(self, obj):
          if isinstance(obj, (datetime.datetime, datetime.date)):
              return obj.isoformat()
          elif isinstance(obj, ObjectId):
              return unicode(obj)
          return json.JSONEncoder.default(self, obj)
  
  def jsonify(*args, **kwargs):
      """ jsonify with support for MongoDB ObjectId
      """
      return Response(json.dumps(dict(*args, **kwargs), cls=MongoJsonEncoder), mimetype='application/json')
  
  def canonicalize(title, year):
      return title.lower().strip() + '-' + str(year).lower().strip()
  
subject: fix title canonicalization