ScoreSaberで検索した一覧からプレイリストを作成するスクリプト

BeatSaberのPPを取得できるranked曲のうち、特定難易度の曲のプレイリストを作成するためのスクリプト

// 1. ScoreSaberにアクセス
// https://scoresaber.com/

// 2.以下検索条件で検索
// Only show verified leaderboards: ON
// Only show ranked leaderboards: ON
// Sort By: Star Difficulty(Desc)
// Star Difficulty (Max): 自分がやりたいランク

// 3. F12で開発者ツールを開いてコンソールで以下を実行して、曲を選択
// Difficulty列をクリックすることで選択可能にする
document.querySelectorAll(".difficulty").forEach(el=>{
  el.addEventListener("click", ev => ev.currentTarget.style.backgroundColor = (ev.currentTarget.style.backgroundColor == "" ? "yellow" : ""))
});

// 4. コンソールで以下を実行してプレイリストを出力
// この内容をxxx.bplistで保存してBeatSaberに取り込み
songs =
[...document.querySelectorAll(".difficulty")]
  .filter(el => el.style.backgroundColor == "yellow")
  .map(el => el.parentElement.innerHTML.match(/[/]imports[/]images[/]songs[/](.*?)\.png/)[1] )
  .map(id => `{"hash":"${id.toLowerCase()}"}`)
  .join(",\n");

now = new Date();
playlist = `{
"playlistTitle":"RANKED_${(now.getFullYear()*10000)+((now.getMonth()+1)*100)+(now.getDate())}",
"songs":[
${songs}
],
"playlistAuthor":"HOGE_PLAYLIST_AUTHOR"
}`

console.log(playlist);