Skip to content

Commit

Permalink
feat: fix difficulty parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
littlebtc committed Nov 21, 2020
1 parent dfffdc1 commit 904693c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@otohime-site/parser",
"version": "0.5.0",
"version": "0.5.1",
"license": "MIT",
"main": "index.js",
"types": "index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/dx_intl/scores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const parseScores = (content: string | HTMLDocument, categoryTo: number = 6, wit
currentCategory: prev.currentCategory + 1
}
}
const rawMusicDifficulty = (curr.querySelector('div')?.className?.match(/basic|advanced|expert|master|remaster/) ?? [''])[0]
const rawMusicDifficulty = (
curr.className?.match(/_(basic|advanced|expert|master|remaster)/) ??
curr.querySelector('div')?.className?.match(/_(basic|advanced|expert|master|remaster)/) ??
['', ''])[1]
const category = prev.currentCategory
const title = curr.querySelector('.music_name_block')?.textContent ?? ''
const difficulty = ['basic', 'advanced', 'expert', 'master', 'remaster'].indexOf(rawMusicDifficulty)
Expand Down

0 comments on commit 904693c

Please sign in to comment.