style: auto format

This commit is contained in:
GitHub Action
2021-10-06 06:29:14 +00:00
parent 8f08dba301
commit 26970d5216
2 changed files with 22 additions and 23 deletions
+6 -6
View File
@@ -87,6 +87,12 @@ Official Website: [https://www.ssm.gov.mo/apps1/PreventWuhanInfection/en.aspx](h
<RouteEn author="luyuhuang" example="/emi-nitta/news" path="/emi-nitta/news"/>
## Fisher Spb
### News
<RouteEn author="denis-ya" example="/fisher-spb/news" path="/fisher-spb/news" />
## HackerOne
### HackerOne Hacker Activity
@@ -220,9 +226,3 @@ Type
| all | rec |
</RouteEn>
## Fisher Spb
### News
<RouteEn author="denis-ya" example="/fisher-spb/news" path="/fisher-spb/news" />
+16 -17
View File
@@ -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,
};
};