Search Support

Beware of phishing attacks: Mozilla will never ask you to call a number or visit a non-Mozilla website. Please ignore such requests.

Learn More

Export console xhr responses

  • 2 uphendule
  • 1 inale nkinga
  • 22 views
  • Igcine ukuphendulwa ngu oudin.manuel

more options

I'm trying to automate a part of my daily work on a website I'm using (not developping). I have to crawl several lists on the website, dig an item in the list, to check some values, and do it again and again ...

Im used to developping in Powershell and python, not with a web browser. I have admin rights on the machine I'm working on. I'd like to use this to catch the json answers of the website (all of them), parse the answers for some values, and automate some kind of popup "Hey, This item in the list is between 90 and 100 !"

No code to show yet, that's what i'm looking for : basic solution for json interception while i'm crawling. I have good knowledge of json parsing using python/powershell, the hard part for me is catching the answers ...

A real time export of all json answers of the network console will be a perfect basis for this ... How can this be done with firefox extension ? I just need a base to start.

Thank you very much for any help you can give. And apologies for my average english ...

Okulungisiwe ngu cor-el

All Replies (2)

more options

Helpful?

more options

Thank You Cor-el !

I managed to get this to work : function logJson(requestDetails) {

 console.log("loading : " + requestDetails.url);
 console.log("loaded Json : " + requestDetails.type );

}

browser.webRequest.onCompleted.addListener(

 logRequests,
 {urls: ["*://*.mywebsite.com/*"],
  types: ["xmlhttprequest"]
 }

);

This code allows me to get a log line on every json that's loaded in the webpage (confirmed with network console) I tried to adapt the code to save the jsons on my Hard drive in real time.

The code i found with your links allows to show the urls of loaded pages, on a click ... Is there a way to actually save this HAR as a file on a hard drive in realtime, or a regular basis ? (every second ...)

The aim for me is to analyse the loaded jsons in realtime, to show a popup when certains conditions are met inside the json (heavy values calculations to do ...)

either by saving the jsons somewher, so that I can analyse them with an outside tool (script)

Either by opening them "on the fly" inside the firefox extension, to make the calculation.

With the given code, I can't figure a way to extract the json response ...

Helpful?

Buza umbuzo

Kufanele ulogele ukungena ku-akhawunti yakho ukuze uphendule amaphosti. Uyacelwauqale umbuzo omusha, uma ungekabi nayo i-akhawunti namanje.