用户:RedDragon/Test2:修订间差异
来自Rizline中文维基
更多操作
小 |
小 |
||
| 第39行: | 第39行: | ||
.then(r => r.text()) | .then(r => r.text()) | ||
.then(text => { | .then(text => { | ||
console.log('原始响应:', text.substring(0, 500)) | |||
const jsonMatch = text.match(/\{"batchcomplete".*\}/s) | |||
if (jsonMatch) { | |||
try { | |||
const data = JSON.parse(jsonMatch[0]) | |||
const pages = data.query.pages | |||
const pageId = Object.keys(pages)[0] | |||
const wikitext = pages[pageId].revisions[0]['*'] | |||
const songs = parseSongsFromWikitext(wikitext) | |||
songs.length > 0 | |||
? loadSongColors(songs[Math.floor(Math.random() * songs.length)]) | |||
: useMockData() | |||
} catch (e) { | |||
console.error('JSON解析失败:', e) | |||
useMockData() | |||
} | |||
} else { | } else { | ||
console.error('未找到JSON数据') | |||
useMockData() | |||
} | } | ||
}) | }) | ||
.catch(e => { | .catch(e => { | ||
| 第97行: | 第95行: | ||
.then(r => r.text()) | .then(r => r.text()) | ||
.then(text => { | .then(text => { | ||
const jsonMatch = text.match(/\{"batchcomplete".*\}/s) | |||
if ( | if (jsonMatch) { | ||
try { | |||
const data = JSON.parse(jsonMatch[0]) | |||
const pages = data.query.pages | |||
const pageId = Object.keys(pages)[0] | |||
if (!pages[pageId].revisions) { | |||
throw new Error('页面不存在') | |||
} | |||
const wikitext = pages[pageId].revisions[0]['*'] | |||
const styles = parseStylesFromWikitext(wikitext) | |||
updateSongInfo(song, { | |||
titleStyle: styles.title || '#94E1FF', | |||
headerStyle: styles.header || '#A3E5FF', | |||
labelStyle: styles.label || '#B2E9FE', | |||
imageUrl: `https://rizwiki.cn/images/thumb/${song.image.substring(0, 1)}/${song.image.substring(0, 2)}/${song.image}/300px-${song.image}`, | |||
pageUrl: `https://rizwiki.cn/wiki/${encodeURIComponent(song.title)}` | |||
}) | |||
} catch (e) { | |||
console.error('解析曲目数据失败:', e) | |||
throw e | |||
} | |||
} else { | } else { | ||
throw new Error('未找到JSON数据') | |||
throw new Error(' | |||
} | } | ||
}) | }) | ||
.catch(e => { | .catch(e => { | ||
2025年10月19日 (日) 22:10的版本
| 曲目 | |
|---|---|
|
|
|
| 限制 | |
| 难度 | a |
| 流速 | b |
| MOD | c |
| 其他 | d |
神秘的随机挑战!
| 曲目 | |
|---|---|
|
| |
| 限制 | |
| 难度 | a |
| 流速 | b |
| MOD | c |
| 其他 | d |
User:RedDragon/Test User:RedDragon/Test1 User:RedDragon/Test2