mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 14:07:06 +08:00
fix: 修復 github-issues 最新評論 獲取的url格式bug
This commit is contained in:
@@ -15,15 +15,13 @@ script.
|
||||
}
|
||||
|
||||
const findTrueUrl = (array) => {
|
||||
let url = ''
|
||||
Promise.all(array.map(item =>
|
||||
fetch(item.url).then(resp => resp.json()).then(data => {
|
||||
const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
|
||||
if (data.user.login === 'utterances-bot') {
|
||||
url = data.body.match(/https?\:\/\/[^\" ]+/ig).slice(-1)
|
||||
return url[0]
|
||||
return urlArray.pop()
|
||||
} else {
|
||||
url = data.body.match(/https?\:\/\/[^\" ]+/i)
|
||||
return url[0]
|
||||
return urlArray.shift()
|
||||
}
|
||||
})
|
||||
)).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user