This Node.js script fetches posts from two endpoints on scored.co, processes the data to calculate scores, and saves the results to a JSON file on your desktop. The script ensures no duplicate users are included and uses the highest score for each user.
- Node.js
- npm (Node Package Manager)
- Clone the repository or download the script to your local machine.
- Open a terminal or command prompt.
- Navigate to the directory containing the script.
- Install the necessary dependencies by running:
npm install axios
- Ensure you have an active internet connection.
- Run the script using Node.js:
node path/to/your/script.js
Make sure to replace path/to/your/script.js
with the actual path to the ip2.js
script on your machine.
The script performs the following steps:
- Fetches posts from two URLs:
https://scored.co/api/v2/post/hotv2.json?community=IP2Always
https://scored.co/api/v2/post/newv2.json?community=IP2Always
- Combines the fetched posts.
- Processes the posts to:
- Calculate scores using
vote_state * 365
. - Ensure each user appears only once with their highest score.
- Sorts the results by score in descending order.
- Saves the results to
output.json
on your desktop.
The script includes the following headers in the requests:
X-API-KEY
X-API-SECRET
Referer
User-Agent
X-Xsrf-Token
X-Api-Platform
The output file, output.json
, is saved to your desktop and contains an array of objects with the following structure:
[
{
"rank": "#1",
"score": 3650,
"username": "exampleUser",
"userLink": "https://communities.win/u/exampleUser"
},
...
]
If there is an error fetching data from either URL, the script will log the error to the console and continue processing the available data.
If you would like to contribute to this project, please fork the repository and submit a pull request.
GNU General Public License (GPL).