I need to parse the html response data but the html to json conversion methods are not working. Here is sample response data:
Looking to grab the csrftoken value from the html.
Basically, you need to either pass in a selector, in order to see the HTML data in the console/anywhere else or using one of the functions of the Cheerio API like $.html().
More information about the Cheerio module can be found here - Iâve added an extract from that site below just to show one method of using Cheerio.
Cheerioâs selector implementation is nearly identical to jQueryâs, so the API is very similar.
$( selector, [context], [root] )
selector searches within the context scope which searches within the root scope. selector and context can be a string expression, DOM Element, array of DOM elements, or cheerio object. root is typically the HTML document string.
This selector method is the starting point for traversing and manipulating the document. Like jQuery, itâs the primary method for selecting elements in the document, but unlike jQuery itâs built on top of the CSSSelect library, which implements most of the Sizzle selectors.
Thanks, this has been a great help for me to capture individual form responses. Is there a way to dynamically iterate through a form to capture all name and values to create as variables? Or is it easier capturing the whole form and passing that into the next API call directly?