def parse_biorxiv_url(url):
  """
  examples:
  http://biorxiv.org/content/early/2017/03/24/120444?rss=1
  http://biorxiv.org/content/early/2017/03/24/120444
  http://biorxiv.org/cgi/content/short/121814v1
  we want to extract the raw id and the version
  """
  if not 'biorxiv.org/' in url: return None, None

  #strip off ?rss=1 if it exists
  url = url[:url.find('?') if '?' in url else None]
  ix = url.rfind('/')
  idversion = url[ix+1:] # extract just the id (and the version)
  parts = idversion.split('v')
  if len(parts) > 2:
      print('error parsing url ' + url)
      return None, None
  if len(parts) == 1:
    return parts[0], None
  else:
    try:
      return parts[0], int(parts[1])
    except ValueError:
      return parts[0], None