This is a basic class that makes it convenient to parse notebooks. I built a larger version of this that was used for clustering documents to create symantic indeices that linked related content together for a personal project. You can use this to parse notebooks for doing things like NLP or preprocessing.
parser = ParseJupyter("./Untitled.ipynb")
parser.get_cells(source_only = True, source_as_string = True)
get_cells
get_cells(cell_type = "code", source_only = False, source_as_string = False)
Limits cells by type. The default is "code" but you can set this to False
to return all types. Also reference the internal class variable self.notebook
to get the parsed version of the notebook with all content.
Only return the source code elements as a list. Handy if you only want source as the output.
Convient option for return sourcecode as a string rather than a list with each newline as a list item.