Skip to content

Commit

Permalink
style: auto format
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 6, 2021
1 parent 8f08dba commit 26970d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
12 changes: 6 additions & 6 deletions docs/en/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -220,9 +226,3 @@ Type
| all | rec |

</RouteEn>

## Fisher Spb

### News

<RouteEn author="denis-ya" example="/fisher-spb/news" path="/fisher-spb/news" />
33 changes: 16 additions & 17 deletions lib/v2/fisher-spb/news.js
Original file line number Diff line number Diff line change
@@ -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'));
Expand All @@ -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,
};
};

0 comments on commit 26970d5

Please sign in to comment.