Skip to content

Commit

Permalink
feat: add 游研社-全部文章 (DIYgod#6214)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwaysHacking authored Nov 24, 2020
1 parent 61e2ef5 commit d839bfa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/game.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的

## 游研社

### 游研社
### 游研社 - 分类文章

<Route author="LightStrawberry" example="/yystv/category/recommend" path="/yystv/category/:category" :paramsDesc="['专栏类型']">

Expand All @@ -522,6 +522,10 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的

</Route>

### 游研社 - 全部文章

<Route author="HaitianLiu" example="/yystv/docs" path="/yystv/docs" />

## 原神

### 新闻
Expand Down
1 change: 1 addition & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ router.get('/gamersky/ent/:category', require('./routes/gamersky/ent'));

// 游研社
router.get('/yystv/category/:category', require('./routes/yystv/category'));
router.get('/yystv/docs', require('./routes/yystv/docs'));

// konami
router.get('/konami/pesmobile/:lang?/:os?', require('./routes/konami/pesmobile'));
Expand Down
34 changes: 34 additions & 0 deletions lib/routes/yystv/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const date = require('@/utils/date');

module.exports = async (ctx) => {
const url = `https://www.yystv.cn/docs`;
const response = await got({
method: 'get',
url: url,
});

const data = response.data;
const $ = cheerio.load(data);

const items = $('.list-container li')
.slice(0, 18)
.map(function () {
const info = {
title: $('.list-article-title', this).text(),
link: 'https://www.yystv.cn' + $('a', this).attr('href'),
pubDate: date($('.c-999', this).text()),
author: $('.handler-author-link', this).text(),
description: $('.list-article-intro', this).text(),
};
return info;
})
.get();

ctx.state.data = {
title: '游研社-' + $('title').text(),
link: `https://www.yystv.cn/docs`,
item: items,
};
};

0 comments on commit d839bfa

Please sign in to comment.