IT之家 匹配下标超出异常

IT之家 匹配下标超出异常
This commit is contained in:
Aomd 2023-04-24 14:08:55 +08:00 committed by GitHub
parent f61a06fc58
commit 6bbe3b718e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ const headers = {
// it之家特殊处理 - url // it之家特殊处理 - url
const replaceLink = (url) => { const replaceLink = (url) => {
const match = url.match(/html\/(\d+)\.htm/)[1]; const match = url.match(/[html|live]\/(\d+)\.htm/)[1];
return `https://www.ithome.com/0/${match.slice(0, 3)}/${match.slice(3)}.htm`; return `https://www.ithome.com/0/${match.slice(0, 3)}/${match.slice(3)}.htm`;
}; };