Fetches data from the Macrocosmos streaming API with automatic timeout.
- Install dependencies:
npm install- Update the API_KEY in
index.jswith your actual API key
Run the script:
npm startThe script will:
- Connect to the streaming API
- Collect data for up to 10 seconds
- Automatically stop before timeout
- Save all collected data to
output.json
Edit index.js to modify:
TIMEOUT_SECONDS: Change the timeout duration (default: 10)keywords: Update the search keywordslimit: Change the data limit