Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

Export console xhr responses

  • 2 个回答
  • 1 人有此问题
  • 12 次查看
  • 最后回复者为 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 ...

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 ...

由cor-el于修改

所有回复 (2)

more options
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 ...