Skip to content

Commit

Permalink
解决某些网址返回分类里含有{}字符串的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
cuiocean committed Mar 30, 2021
1 parent 26d62cd commit 2ddfc66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/site/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ const zy = {
const jsondata = json.rss === undefined ? json : json.rss
const arr = []
if (jsondata.class) {
// 有些网站返回的分类名里会含有一串包含在{}内的字符串,移除掉
const regex = /\{.*\}/i
for (const i of jsondata.class.ty) {
const j = {
tid: i._id,
name: i._t
name: i._t.replace(regex, '')
}
arr.push(j)
}
Expand Down

0 comments on commit 2ddfc66

Please sign in to comment.