print("Loading index")
    md = readmetadata()
    for record in data:
        id = record['metadata']['id']
        metadata = md[id]
        pprint(metadata)
        sys.exit(0)
        title = record['book']['title']
        isbn = isbnlib.isbn_from_words(title)
        metadata = isbnlib.meta(isbn)
        pprint(metadata)
        extracted_title = ''
        print title, extracted_title, isbn
        time.sleep(1)

def download_isbn():
    with open('raw.json') as input:
        data = json.load(input)
    '''
    print("Loading index")
    md = readmetadata()
    for record in data:
        id = record['metadata']['id']
        metadata = md[id]
        pprint(metadata)
        sys.exit(0)
        title = record['book']['title']
        isbn = isbnlib.isbn_from_words(title)
        metadata = isbnlib.meta(isbn)
        pprint(metadata)
        extracted_title = ''
        print title, extracted_title, isbn
        time.sleep(1)'''
    url = 'http://www.librarything.com/api/thingTitle/'
    for record in data:
        title = record['book']['title']
        final_url = url+quote_plus(title)
        content = requests.get(final_url).content
        soup = BeautifulSoup(content)
        extracted_title = soup.idlist.title.string
        isbn = soup.idlist.find("isbn").string
        metadata = isbnlib.meta(isbn)
        pprint(metadata)
        #print title, extracted_title, min(isbns)
        time.sleep(1)