Using JS to fetch network data and run functions

Hello coders!!

I am a complete stranger to JavaScript so please pardon my ignorance if any.

I have an internal website which allows me to download release reports. I have an idea to create a userscript to download the release report in a CSV. This is how the flow is

User lands on a release report page

Makes a selection and clicks on a button

This shows release data in raw format (which is extremely crude and not user friendly). A download JSON button is present on the page which can let you download the data in JSON format

I observed on step 2 an API call is made with a release ID which is of course dynamic.

My plan is to

show a button download CSV when Download JSON button is available - I have completed this

Intercept the GET request whose request URL is dynamic and fetch the JSON

Flatten this JSON and create a CSV with whatever I need - I have this right now with python.

My questions are -

Is it possible to fetch network request headers - since the URL will be dynamic I have to rely on the last call the browser made? I know the format but a regex request URL will not work (I realised later how obviously silly that was)

My JSON normalising code is in python. Since the JSON itself is very dynamic and complex I used Pandas but I have no idea if I can even invoke it through a JavaScript.

Is there a better way to do this using just Python maybe? Maybe I shouldn’t rely on a userscript, is there an alternative to work with a browser for this specific task?

I’m looking for any direction or even a possible different approach.

Many thanks.

I got this with my MIT friends who are genius in this…
https://tutuappx.com/

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.