Scraping molecular information from ChemSpider using Processing.

I’ve spent the evening knocking out this little sketch to scrape molecular information from ChemSpider to inform my mass spectrometry. Until now I’ve been doing this by hand or getting the students to, when they are able, but this is the start of my attempt to automate the process. Ultimately I will just want to feed it a text file of compound names and it will parse the output into a document.

Open a Processing window, copy the code below into it, edit the first string to contain the name of the compound of your choice and click run. Here’s an image of example output.