Search code examples
google-chromegoogle-chrome-extensiongoogle-chrome-devtools

How to export response bodies only using chrome


enter image description here

I'm working with a website using chrome. I want to grab only the responses to certain requests (which I am filtering for in the screenshot). Previously I tried to Export all http requests on a specific page to txt/csv , so I see that you can get a har file with a lot of unneeded info, but I would like just grab just the resonse bodies. Is this possible using devtools or an extension?


Solution

  • const re = /\/stackoverflow/
    const result = HAR.log.entries.filter(entiry => re.test(entiry.request.url))
    console.log(result)
    

    That's all you need. HAR - your data with

    a lot of unneeded info

    re - your filter

    Note the / in the regexp. The filter in the DevTools doesn't take the domain into account.