feat: add imuseum rss (#478)
This commit is contained in:
parent
616ff800e4
commit
43aecb8469
|
|
@ -232,6 +232,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 特价机票 Flight deals
|
||||
- Google
|
||||
- 谷歌学术关键词更新
|
||||
- iMuseum
|
||||
- 展览信息
|
||||
|
||||
</details>
|
||||
|
||||
|
|
|
|||
|
|
@ -1864,6 +1864,24 @@ nearby: 可选 0 或 1,默认 0 为不包括,是否包括临近机场
|
|||
1. 简单模式,例如「data visualization」,[https://rsshub.app/google/scholar/data+visualization](https://rsshub.app/google/scholar/data+visualization)。
|
||||
2. 高级模式,前往 [Google Scholar](https://scholar.google.com/schhp?hl=zh-cn&as_sdt=0,5),点击左上角,选择高级搜索并提交查询。此时 URL 应为:[https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5](https://scholar.google.com/scholar?as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5),复制`https://scholar.google.com/scholar?`后的所有语句作为本路由的查询参数。例子所对应的完整路由为[https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5](https://rsshub.app/google/scholar/as_q=data+visualization&as_epq=&as_oq=&as_eq=&as_occt=any&as_sauthors=&as_publication=&as_ylo=2018&as_yhi=&hl=zh-CN&as_sdt=0%2C5)。
|
||||
|
||||
## iMuseum
|
||||
|
||||
### 展览信息 <Author uid="sinchang"/>
|
||||
|
||||
举例: [https://rsshub.app/imuseum/shanghai/all](https://rsshub.app/imuseum/shanghai/all)
|
||||
|
||||
路由: `/imuseum/:city/:type`
|
||||
|
||||
参数:
|
||||
|
||||
city,必选,如 shanghai、beijing
|
||||
|
||||
type,可选,不填则默认为 `all`
|
||||
|
||||
| 全部 | 最新 | 热门 | 即将结束 | 即将开始 | 已结束 |
|
||||
| ---- | ------ | ---- | -------- | -------- | -------- |
|
||||
| all | latest | hot | end_soon | coming | outdated |
|
||||
|
||||
## Hopper Flight Deals
|
||||
|
||||
### Hopper 特价机票 <Author uid="HenryQW"/>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"dev": "nodemon index.js",
|
||||
"docs:dev": "vuepress dev docs",
|
||||
"docs:build": "vuepress build docs",
|
||||
"format": "eslint \"**/*.js\" --fix && prettier \"**/*.{js,json,md}\" --write",
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
"eslint-config-prettier": "^3.0.1",
|
||||
"eslint-plugin-prettier": "^2.6.2",
|
||||
"lint-staged": "^7.2.2",
|
||||
"nodemon": "^1.18.3",
|
||||
"prettier": "^1.14.2",
|
||||
"prettier-check": "^2.0.0",
|
||||
"vuepress": "0.14.2",
|
||||
|
|
|
|||
|
|
@ -419,6 +419,9 @@ router.get('/fir/update/:id', require('./routes/fir/update'));
|
|||
// Google
|
||||
router.get('/google/scholar/:query', require('./routes/google/scholar'));
|
||||
|
||||
// 每日环球展览 iMuseum
|
||||
router.get('/imuseum/:city/:type', require('./routes/imuseum'));
|
||||
|
||||
// AppStore
|
||||
router.get('/appstore/update/:country/:id', require('./routes/appstore/update'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
const baseUrl = 'https://art.icity.ly';
|
||||
|
||||
/**
|
||||
* type: ['all', 'latest', 'hot', 'end_soon', 'coming', 'outdated']
|
||||
* city: ['shanghai', 'beijing',....]
|
||||
*/
|
||||
module.exports = async (ctx) => {
|
||||
const city = ctx.params.city;
|
||||
const type = ctx.params.type || 'all';
|
||||
const url = `${baseUrl}/${city}/${type}`;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.imsm-entries.list li');
|
||||
ctx.state.data = {
|
||||
title: `${$('title').text()}`,
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((item, index) => {
|
||||
item = $(index);
|
||||
const pretitle = item.find('.pretitle').children()[0].prev ? item.find('.pretitle').children()[0].prev.data : '';
|
||||
const subtitle = item.find('.subtitle').children()[0].next ? item.find('.subtitle').children()[0].next.data : '';
|
||||
return {
|
||||
title: item.find('div.title').text(),
|
||||
description: `${subtitle} ${pretitle} <img referrerpolicy="no-referrer" src="${item.find('img.cover').attr('src')}">`,
|
||||
link: `${baseUrl}${item.find('a.info').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue