Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Riotcoke123/Scuffed-IP2-Leaderboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scuffed IP2 Leaderboard

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.

Requirements

  • Node.js
  • npm (Node Package Manager)

Installation

  1. Clone the repository or download the script to your local machine.
  2. Open a terminal or command prompt.
  3. Navigate to the directory containing the script.
  4. Install the necessary dependencies by running:
npm install axios

Usage

  1. Ensure you have an active internet connection.
  2. 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.

Script Details

The script performs the following steps:

  1. 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
  2. Combines the fetched posts.
  3. Processes the posts to:
    • Calculate scores using vote_state * 365.
    • Ensure each user appears only once with their highest score.
  4. Sorts the results by score in descending order.
  5. Saves the results to output.json on your desktop.

Headers Used

The script includes the following headers in the requests:

  • X-API-KEY
  • X-API-SECRET
  • Referer
  • User-Agent
  • X-Xsrf-Token
  • X-Api-Platform

Output

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"
  },
  ...
]
    

Error Handling

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.

Contributing

If you would like to contribute to this project, please fork the repository and submit a pull request.

License

GNU General Public License (GPL).