fix: map live fetch status failure code

This commit is contained in:
hajimi
2026-06-21 13:02:22 +08:00
parent c59b7ade29
commit a8a678a5f6
3 changed files with 16 additions and 4 deletions
@@ -45,6 +45,18 @@ def main() -> None:
"popup selection reset should prefer default_play_url"
assert re.search(r"fetch_status.*last_fetch_at", popup_source, re.S) or "update_time" in popup_source, \
"popup metadata should use fetch_status and last_fetch_at/update_time"
assert re.search(r"normalized === '0'.*待抓取", popup_source, re.S), \
"popup should map fetch_status 0 to pending label"
assert re.search(r"normalized === '1'.*已抓取", popup_source, re.S), \
"popup should map fetch_status 1 to success label"
assert re.search(r"normalized === '2'.*抓取失败", popup_source, re.S), \
"popup should map fetch_status 2 to failure label"
assert re.search(r"normalized === '0'.*待抓取", detail_source, re.S), \
"page should map fetch_status 0 to pending label"
assert re.search(r"normalized === '1'.*已抓取", detail_source, re.S), \
"page should map fetch_status 1 to success label"
assert re.search(r"normalized === '2'.*抓取失败", detail_source, re.S), \
"page should map fetch_status 2 to failure label"
assert "/match/detail" in api_source, "match detail API path should stay on /match/detail"
@@ -71,9 +71,9 @@ const getFetchStatusText = (value: unknown) => {
const text = normalizeText(value)
if (!text) return ''
const normalized = text.toLowerCase()
if (normalized === 'success' || normalized === '1') return '已抓取'
if (normalized === 'pending' || normalized === '0') return '待抓取'
if (normalized === 'failed' || normalized === '-1') return '抓取失败'
if (normalized === 'success' || normalized === '1') return '抓取'
if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败'
return text
}
@@ -518,9 +518,9 @@ const getLiveFetchStatusText = (value: unknown) => {
const text = normalizeLiveText(value)
if (!text) return ''
const normalized = text.toLowerCase()
if (normalized === 'success' || normalized === '1') return '已抓取'
if (normalized === 'pending' || normalized === '0') return '待抓取'
if (normalized === 'failed' || normalized === '-1') return '抓取失败'
if (normalized === 'success' || normalized === '1') return '抓取'
if (normalized === 'failed' || normalized === 'error' || normalized === '2') return '抓取失败'
return text
}