diff --git a/lib/routes/gamer/gnn_index.js b/lib/routes/gamer/gnn_index.js index 5bc8dbf99..f77f843af 100644 --- a/lib/routes/gamer/gnn_index.js +++ b/lib/routes/gamer/gnn_index.js @@ -84,30 +84,28 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map(async (item) => { - let author = ''; item.description = await ctx.cache.tryGet(item.link, async () => { const response = await got.get(item.link); let component = ''; const urlReg = /window.location.replace\('.*'/g; if (response.body.search(urlReg) < 0) { const $ = cheerio.load(response.data); + item.author = $('span.GN-lbox3C').text().split(')')[0].split(' 報導')[0].split(' 提供')[0].split(' 同意授權轉載')[0].replace('(', ''); component = $('div.GN-lbox3B').html(); - author = $('span.GN-lbox3C').text().split(')')[0].split(' 報導')[0].split(' 提供')[0].split(' 同意授權轉載')[0].replace('(', ''); } else { const newUrl = response.body.match(urlReg)[0].split('(')[1].replace(/'/g, ''); const _response = await got.get(newUrl); const _$ = cheerio.load(_response.data); + item.author = _$('span.ST1').text().split('│', 2)[0].split('作者:')[1]; component = _$('div.MSG-list8C').html(); if (!component) { + item.author = _$('a.caption-text.primary').text(); component = _$('div.text-paragraph').html(); } - item.link = newUrl; - author = _$('span.ST1').text().split('│', 2)[0].split('作者:')[1]; } component = component.replace(/\b(data-src)\b/g, 'src'); return component; }); - item.author = author; return item; }) );