fix: URL pattern match failed (#91)

This commit is contained in:
mio
2025-01-15 20:47:11 +08:00
parent b391a7daf5
commit fc3a9c1dcc
2 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "star-rail-warp-export", "name": "star-rail-warp-export",
"version": "0.1.13", "version": "0.1.14",
"main": "./dist/electron/main/main.js", "main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>", "author": "biuuu <https://github.com/biuuu>",
"homepage": "https://github.com/biuuu/star-rail-warp-export", "homepage": "https://github.com/biuuu/star-rail-warp-export",

View File

@ -161,7 +161,7 @@ const readLog = async () => {
const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i) const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i)
if (gamePathMch) { if (gamePathMch) {
const [cacheText, cacheFile] = await getCacheText(gamePathMch[0]) const [cacheText, cacheFile] = await getCacheText(gamePathMch[0])
const urlMch = cacheText.match(/https[^?]+?\?[^?]+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g) const urlMch = cacheText.match(/https[^?]+?\?[^?]+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_/g)
if (urlMch) { if (urlMch) {
cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '') cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '')
return getLatestUrl(urlMch) return getLatestUrl(urlMch)
@ -215,13 +215,13 @@ const getGachaLogs = async ({ name, key }, queryString) => {
let endId = '0' let endId = '0'
const url = `${apiDomain}/common/gacha_record/api/getGachaLog?${queryString}` const url = `${apiDomain}/common/gacha_record/api/getGachaLog?${queryString}`
do { do {
if (page % 10 === 0) { // if (page % 10 === 0) {
sendMsg(i18n.parse(text.fetch.interval, { name, page })) // sendMsg(i18n.parse(text.fetch.interval, { name, page }))
await sleep(1) // await sleep(1)
} // }
await sleep(0.3)
sendMsg(i18n.parse(text.fetch.current, { name, page })) sendMsg(i18n.parse(text.fetch.current, { name, page }))
res = await getGachaLog({ key, page, name, url, endId, retryCount: 5 }) res = await getGachaLog({ key, page, name, url, endId, retryCount: 5 })
await sleep(0.3)
logs = res?.list || [] logs = res?.list || []
if (!uid && logs.length) { if (!uid && logs.length) {
uid = logs[0].uid uid = logs[0].uid