Add Awesome Pigtails (#470)
This commit is contained in:
parent
43aecb8469
commit
4677703be5
|
|
@ -232,6 +232,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 特价机票 Flight deals
|
||||
- Google
|
||||
- 谷歌学术关键词更新
|
||||
- Awesome Pigtails
|
||||
- 最新图片
|
||||
- iMuseum
|
||||
- 展览信息
|
||||
|
||||
|
|
|
|||
|
|
@ -1864,6 +1864,16 @@ 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)。
|
||||
|
||||
## Awesome Pigtails
|
||||
|
||||
### 最新图片 <author uid="Chingyat" />
|
||||
|
||||
举例: [https://rsshub.app/pigtails](https://rsshub.app/pigtails)
|
||||
|
||||
路由: `/pigtails`
|
||||
|
||||
参数: 无
|
||||
|
||||
## iMuseum
|
||||
|
||||
### 展览信息 <Author uid="sinchang"/>
|
||||
|
|
|
|||
|
|
@ -419,6 +419,9 @@ router.get('/fir/update/:id', require('./routes/fir/update'));
|
|||
// Google
|
||||
router.get('/google/scholar/:query', require('./routes/google/scholar'));
|
||||
|
||||
// Awesome Pigtals
|
||||
router.get('/pigtails', require('./routes/pigtails'));
|
||||
|
||||
// 每日环球展览 iMuseum
|
||||
router.get('/imuseum/:city/:type', require('./routes/imuseum'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
const config = require('../../config');
|
||||
const cheerio = require('cheerio');
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
const base_url = 'https://pigtails.info';
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: base_url,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: base_url,
|
||||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = [];
|
||||
$('.posts > .post > a').each((idx, item) => {
|
||||
const $item = $(item);
|
||||
const img_url = $('.thumb', item)
|
||||
.attr('style')
|
||||
.split(')')[0]
|
||||
.split('(')[1];
|
||||
items.push({
|
||||
title: $item.text(),
|
||||
description: `<img referrerpolicy="no-referrer" src="${img_url}" >`,
|
||||
link: `${base_url}${$item.attr('href')}`,
|
||||
});
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Awesome Pigtails',
|
||||
description: 'Share awesome pigtails.',
|
||||
link: base_url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue