Getting data stream from terminal to max patch via shell object

Abao's icon

Hi there

I am zero to node js but I just wonder if anyone can help me to make this happen by two approaches? I am trying to get the stream datas from a site called Blitzortung for a research of data sonification of lightning location. I have found this code on github made and has successfully running it in my terminal. But how do I get the stream data directly to my max patch?

1. I am thinking of the dirtiest way to route the datas from the terminal to max via the object shell, however the shell object in max isn't really working for me: I tried to go to the root with /cd and put "npm run example" and it didn't get me there to the root, nor the npm script was taken.

https://github.com/SimonSchick/BlitzortungAPI

the example.js works in terminal environment by putting "npm run example".

2. Or is it possible that someone can translate this example.js file in this github account into script with maxAPI function? I think it's not a easy task but still am trying to give it a shot here.

tutorial link: https://www.youtube.com/watch?v=mSdwOsykowk&t=27s

The left window in the image is the example.js in the github, the window in the left is a tutorial I found to route weather data from web by free API.

Bradley Korth's icon

I suppose if you don't have to run the program every time, and you just want to save the data you got, you could just save all this into a JSON file, then have Max open up the JSON file in either the js object or node.script. If it reads it as a string; no problem, just JSON.parse that string.

Abao's icon

Hi Bradley, thanks for the reply, will try it out!