Skip to content

Instantly share code, notes, and snippets.

@mrbusche
Last active October 16, 2024 12:33
Show Gist options
  • Save mrbusche/b43af0be39eeec32cb6ab5f1d8610c40 to your computer and use it in GitHub Desktop.
Save mrbusche/b43af0be39eeec32cb6ab5f1d8610c40 to your computer and use it in GitHub Desktop.
Find intersection of 4for4 rest of season rankings and ETR top 150

Find intersection of 4for4 rest of season rankings and ETR top 150

On ETR top 150 page, run this

const top150 = document.querySelectorAll("td.ninja_clmn_nm_player");
let top150Players = [];
top150.forEach((player) =>
  player.innerText.includes(" ")
    ? top150Players.push(player.innerText.split(" (")[0])
    : ""
);
console.log(top150Players);

Copy the object logged above and paste below along with the rest of the code

const top150 = ${copied object above}

const unowned = [
  ...document.querySelectorAll(
    "td:not(.all-rosters-player):not(.my-roster-player):not(.numeric-cell):not(:empty)"
  ),
];
const unownedPlayers = unowned.map((player) => player.innerText.split(" (")[0]);

const myPlayers = [...document.querySelectorAll("td.my-roster-player")];
const teamPlayers = myPlayers.map((player) =>
  player.innerText.split(" (")[0].replace(" Jr.", "")
);

console.log("unowned top 150");
top150.filter((value, index) =>
  unownedPlayers.includes(value)
    ? console.log(`${index + 1}: ${value}`)
    : undefined
);
console.log("I own, not top 150");
teamPlayers.filter((value, index) =>
  !top150.includes(value) ? console.log(`${value}`) : undefined
);
console.log("I own, top 150");
top150.filter((value, index) =>
  teamPlayers.includes(value)
    ? console.log(`${index + 1}: ${value}`)
    : undefined
);

You'll see output like the following (Guillotine league)

unowned top 150
1: Saquon Barkley
30: Davante Adams
51: Aaron Jones
65: Puka Nacua
76: Evan Engram
85: Jakobi Meyers
94: Christian Watson
104: Rachaad White
109: Ty Chandler
114: Kimani Vidal
119: Jerry Jeudy
121: Jonathon Brooks
123: Ray Davis
125: Raheem Mostert
129: JuJu Smith-Schuster
130: Antonio Gibson
132: Dallas Goedert
134: Pat Freiermuth
136: Geno Smith
138: Jaylen Wright
140: Jordan Whittington
141: Alexander Mattison
143: Blake Corum
144: Adonai Mitchell
145: Emanuel Wilson
147: Ja'Lynn Polk
I own, not top 150
Isaiah Likely
Tyler Goodson
I own, top 150
12: Jahmyr Gibbs
13: Drake London
17: DeVonta Smith
44: Brian Thomas
57: Kyler Murray
64: Chase Brown
84: Anthony Richardson
106: Rico Dowdle
120: Tyrone Tracy
149: Michael Wilson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment