bugfix 解决极少数album没有标题,正则匹配失败问题
This commit is contained in:
@@ -82,9 +82,20 @@ async function fetch({ albumId, debug = false, update = false }) {
|
||||
}
|
||||
|
||||
// 正则匹配
|
||||
let albumInfoDict;
|
||||
let regExResult = /\<script type\=\"application\/ld\+json\"\>([\S\s]*?)\<\/script\>/.exec(html);
|
||||
let albumInfoJSONString = regExResult[1];
|
||||
let albumInfoDict = JSON.parse(albumInfoJSONString);
|
||||
if (regExResult) {
|
||||
let albumInfoJSONString = regExResult[1];
|
||||
albumInfoDict = JSON.parse(albumInfoJSONString);
|
||||
} else {
|
||||
// 极少数album没有 <script type="application/ld+json">......</script> 这块内容
|
||||
// 例如:71715963,71738618。这些album都没有标题,所以下面这三项就直接保留空字符串
|
||||
albumInfoDict = {
|
||||
"title": "",
|
||||
"description": "",
|
||||
"pubDate": ""
|
||||
}
|
||||
}
|
||||
// console.log(albumInfoDict);
|
||||
|
||||
// 发行公司
|
||||
|
Reference in New Issue
Block a user