From ab16878ba34773a60fcfad3b7aff43db061043d7 Mon Sep 17 00:00:00 2001 From: KotoriK <52659125+KotoriK@users.noreply.github.com> Date: Wed, 30 Dec 2020 01:46:12 +0800 Subject: [PATCH] format --- lib/router.js | 2 +- lib/routes/gamegrape/index.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/router.js b/lib/router.js index 40e64ff11..c45ff2711 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3780,7 +3780,7 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog')); // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); -//游戏葡萄 +// 游戏葡萄 router.get('/gamegrape/:id?', require('./routes/gamegrape/index')); module.exports = router; diff --git a/lib/routes/gamegrape/index.js b/lib/routes/gamegrape/index.js index 750da88d1..999008231 100644 --- a/lib/routes/gamegrape/index.js +++ b/lib/routes/gamegrape/index.js @@ -1,6 +1,6 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -const BASE_URL = 'http://youxiputao.com' +const BASE_URL = 'http://youxiputao.com'; function resolveRelativeTime(relativeTime) { const reg = /\S* · (\d{1,2}天)?(\d{1,2}小时)?(\d{1,2}分钟)?/; @@ -23,7 +23,7 @@ function resolveRelativeTime(relativeTime) { } module.exports = async (ctx) => { const { id } = ctx.params; - const feed_url = `${BASE_URL}/article/${id ? `/index/id/${id}` : ''}` + const feed_url = `${BASE_URL}/article/${id ? `/index/id/${id}` : ''}`; const resp = await got({ method: 'get', url: feed_url, @@ -33,12 +33,12 @@ module.exports = async (ctx) => { const list = $('.news-info-box') .map((_, item) => { item = $(item); - const txt_author_pubDate = $(item.find('div > p > span')[1]).text() + const txt_author_pubDate = $(item.find('div > p > span')[1]).text(); const author = `${txt_author_pubDate}`.replace(/ · \S*$/, ''); const link = BASE_URL + item.find('a.cover').attr('href'); const title = item.parent().find('h4').text(); - const description = $(item.find('div > p')[0]).text() - const pubDate = Date.now() - resolveRelativeTime(txt_author_pubDate) + const description = $(item.find('div > p')[0]).text(); + const pubDate = Date.now() - resolveRelativeTime(txt_author_pubDate); return { title, link, @@ -47,7 +47,7 @@ module.exports = async (ctx) => { }; }) .get(); - const feed_title = $('title').text() + const feed_title = $('title').text(); ctx.state.data = { title: feed_title,