diff --git a/README.md b/README.md index fccd709..f1c0c20 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,15 @@ To run the script in GitHub Codespaces: note: if you're using GitHub Codespaces, this step may have already been run automatically 6. run the script with ``` - node unfollow.js + SCRIPT_USERNAME=your_username SCRIPT_TOKEN=your_token SCRIPT_LIMIT=2500 node unfollow.js ``` + (Change SCRIPT_LIMIT to your desired subset size. If not set, defaults to 1000.) + +**Note:** +- The above one-line command works in Codespaces, as I tested it myself. +- On local Windows (Command Prompt or PowerShell), this command might not work as shown. +If you are on Windows and encounter issues, it is highly +encouraged to use GitHub Codespaces for a seamless experience. ## USE CASE diff --git a/unfollow.js b/unfollow.js index 351c1e6..0ef2989 100644 --- a/unfollow.js +++ b/unfollow.js @@ -1,9 +1,21 @@ (async () => { const { Octokit } = await import("@octokit/rest"); - const octokit = new Octokit({ auth: `your_token_with_correct_permission` }); + // Read credentials from environment variables + const username = process.env.SCRIPT_USERNAME; + const token = process.env.SCRIPT_TOKEN; + // Allow limit to be set via environment variable or default to 1000 + const limit = process.env.SCRIPT_LIMIT ? parseInt(process.env.SCRIPT_LIMIT, 10) : 1000; + + if (!username || !token) { + console.error("Error: SCRIPT_USERNAME and SCRIPT_TOKEN must be set as environment variables."); + process.exit(1); + } + if (isNaN(limit) || limit <= 0) { + console.error("Error: SCRIPT_LIMIT must be a positive integer if set."); + process.exit(1); + } - const username = 'your_username'; - const limit = 1000; + const octokit = new Octokit({ auth: token }); const userInfo = await octokit.rest.users.getByUsername({ username }); const totalFollowing = userInfo.data.following;
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: