From 26970d5216fc5800dfcaa48f65a212e9d0f299c4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 6 Oct 2021 06:29:14 +0000 Subject: [PATCH] style: auto format --- docs/en/other.md | 12 ++++++------ lib/v2/fisher-spb/news.js | 33 ++++++++++++++++----------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/docs/en/other.md b/docs/en/other.md index d97c7c5d1..fe27986a5 100644 --- a/docs/en/other.md +++ b/docs/en/other.md @@ -87,6 +87,12 @@ Official Website: [https://www.ssm.gov.mo/apps1/PreventWuhanInfection/en.aspx](h +## Fisher Spb + +### News + + + ## HackerOne ### HackerOne Hacker Activity @@ -220,9 +226,3 @@ Type | all | rec | - -## Fisher Spb - -### News - - diff --git a/lib/v2/fisher-spb/news.js b/lib/v2/fisher-spb/news.js index 8bd04c42d..fd28abc39 100644 --- a/lib/v2/fisher-spb/news.js +++ b/lib/v2/fisher-spb/news.js @@ -1,20 +1,19 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const iconv = require('iconv-lite'); +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const iconv = require('iconv-lite'); const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); +const { art } = require('@/utils/render'); +const path = require('path'); module.exports = async (ctx) => { - const renderVideo = (link) => art(path.join(__dirname, './templates/video.art'), { link }); const renderImage = (href) => art(path.join(__dirname, './templates/image.art'), { href }); - const rootUrl = 'https://fisher.spb.ru/news/'; + const rootUrl = 'https://fisher.spb.ru/news/'; const response = await got({ - method: 'get', - url: rootUrl, - responseType: 'buffer' + method: 'get', + url: rootUrl, + responseType: 'buffer', }); const $ = cheerio.load(iconv.decode(response.data, 'windows-1251')); @@ -33,18 +32,18 @@ module.exports = async (ctx) => { const items = $('.news-message') .map((_, elem) => ({ - pubDate: parseDate($('.news-message-date', elem).text().trim(), 'DD.MM.YYYY HH:mm'), - title: $('.news-message-location', elem).text().trim(), + pubDate: parseDate($('.news-message-date', elem).text().trim(), 'DD.MM.YYYY HH:mm'), + title: $('.news-message-location', elem).text().trim(), description: descBuilder(elem).html(), - author: $('.news-message-user', elem).text().trim(), - guid: $(elem).attr('id'), - link: rootUrl + $('.news-message-comments-number > a', elem).attr('href') + author: $('.news-message-user', elem).text().trim(), + guid: $(elem).attr('id'), + link: rootUrl + $('.news-message-comments-number > a', elem).attr('href'), })) .get(); ctx.state.data = { title: $('head > title').text().trim(), - link: rootUrl, - item: items + link: rootUrl, + item: items, }; };