mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 3 routes (#3434)
This commit is contained in:
@@ -747,4 +747,46 @@
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'3ycy.com': {
|
||||
_name: '三界异次元',
|
||||
www: [
|
||||
{
|
||||
title: '最近更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#san-jie-yi-ci-yuan',
|
||||
source: '/',
|
||||
target: '/3ycy/home',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'emi-nitta.net': {
|
||||
_name: 'Emi Nitta',
|
||||
'.': [
|
||||
{
|
||||
title: '最近更新',
|
||||
docs: 'https://docs.rsshub.app/other.html#xin-tian-hui-hai-guan-fang-wang-zhan',
|
||||
source: '/updates',
|
||||
target: '/emi-nitta/updates',
|
||||
},
|
||||
{
|
||||
title: '新闻',
|
||||
docs: 'https://docs.rsshub.app/other.html#xin-tian-hui-hai-guan-fang-wang-zhan',
|
||||
source: '/contents/news',
|
||||
target: '/emi-nitta/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'alter-shanghai.cn': {
|
||||
_name: 'Alter',
|
||||
'.': [
|
||||
{
|
||||
title: '新闻',
|
||||
docs: 'https://docs.rsshub.app/shopping.html#alter-zhong-guo',
|
||||
source: '/cn/news.html',
|
||||
target: '/alter-cn/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -229,6 +229,12 @@ pageClass: routes
|
||||
|
||||
<Route author="junfengP" path="/manhuadb/:id" example="/manhuadb/comics/1711" :paramsDesc="['漫画ID']"/>
|
||||
|
||||
## 三界异次元
|
||||
|
||||
### 三界异次元
|
||||
|
||||
<Route author="luyuhuang" example="/3ycy/home" path="/3ycy/home"/>
|
||||
|
||||
## 鼠绘漫画
|
||||
|
||||
### 鼠绘漫画
|
||||
|
||||
@@ -45,6 +45,16 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Emi Nitta official website
|
||||
|
||||
### Recent update
|
||||
|
||||
<Route author="luyuhuang" example="/emi-nitta/updates" path="/emi-nitta/updates"/>
|
||||
|
||||
### News
|
||||
|
||||
<Route author="luyuhuang" example="/emi-nitta/news" path="/emi-nitta/news"/>
|
||||
|
||||
## EZTV
|
||||
|
||||
::: tip
|
||||
|
||||
@@ -3,3 +3,9 @@ pageClass: routes
|
||||
---
|
||||
|
||||
# Shopping
|
||||
|
||||
## Alter China
|
||||
|
||||
### News
|
||||
|
||||
<Route author="luyuhuang" example="/alter-cn/news" path="/alter-cn/news"/>
|
||||
|
||||
@@ -375,6 +375,16 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="kt286" example="/tprtc/news" path="/tprtc/news"/>
|
||||
|
||||
## 新田惠海官方网站
|
||||
|
||||
### 最近的更新
|
||||
|
||||
<Route author="luyuhuang" example="/emi-nitta/updates" path="/emi-nitta/updates"/>
|
||||
|
||||
### 新闻
|
||||
|
||||
<Route author="luyuhuang" example="/emi-nitta/news" path="/emi-nitta/news"/>
|
||||
|
||||
## 油价
|
||||
|
||||
### 今日油价
|
||||
|
||||
@@ -4,6 +4,12 @@ pageClass: routes
|
||||
|
||||
# 购物
|
||||
|
||||
## Alter 中国
|
||||
|
||||
### 新闻
|
||||
|
||||
<Route author="luyuhuang" example="/alter-cn/news" path="/alter-cn/news"/>
|
||||
|
||||
## Westore
|
||||
|
||||
### 新品
|
||||
|
||||
@@ -1935,6 +1935,15 @@ router.get('/gov/cnca/hydt', require('./routes/gov/cnca/hydt'));
|
||||
|
||||
router.get('/gov/cnca/zxtz', require('./routes/gov/cnca/zxtz'));
|
||||
|
||||
// 三界异次元
|
||||
router.get('/3ycy/home', require('./routes/3ycy/home.js'));
|
||||
|
||||
// Emi Nitta official website
|
||||
router.get('/emi-nitta/:type', require('./routes/emi-nitta/home'));
|
||||
|
||||
// Alter China
|
||||
router.get('/alter-cn/news', require('./routes/alter-cn/news'));
|
||||
|
||||
// Visual Studio Code Marketplace
|
||||
router.get('/vscode/marketplace/:type?', require('./routes/vscode/marketplace'));
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const root_url = 'http://www.3ycy.com';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: root_url,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('div.postList div.postItem');
|
||||
|
||||
const count = [];
|
||||
for (let i = 0; i < Math.min(list.length, 10); ++i) {
|
||||
count.push(i);
|
||||
}
|
||||
|
||||
const items = await Promise.all(
|
||||
count.map(async (i) => {
|
||||
const item = $(list[i]);
|
||||
const title = item.find('h3 a').first();
|
||||
const link = title.attr('href');
|
||||
|
||||
return await ctx.cache.tryGet('3ycy' + link, async () => {
|
||||
const date = item
|
||||
.find('div.postSubtitle')
|
||||
.text()
|
||||
.trim();
|
||||
const match = /(\d+\/\d+\/\d{4}\s+\d+:\d+:\d+\s*(?:AM|PM))/i.exec(date);
|
||||
const pubDate = match && new Date(match[1] + ' GMT+8').toUTCString();
|
||||
|
||||
const res = await got({ method: 'get', url: url.resolve(root_url, link) });
|
||||
const content = cheerio.load(res.data);
|
||||
|
||||
return {
|
||||
title: title.text(),
|
||||
link: link,
|
||||
pubDate: pubDate,
|
||||
description: content('div.postBody').html(),
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '三界异次元',
|
||||
link: root_url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const root_url = 'http://alter-shanghai.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url.resolve(root_url, '/cn/news.html'),
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('ul.listnews li')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
const m = /(\d{4}-\d+-\d+)/.exec(item.find('span').text());
|
||||
return {
|
||||
title: a.text(),
|
||||
link: a.attr('href'),
|
||||
pubDate: m && new Date(m[1] + ' GMT+8').toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet('alter-cn' + item.link, async () => {
|
||||
const res = await got({ method: 'get', url: url.resolve(root_url, item.link) });
|
||||
const content = cheerio.load(res.data);
|
||||
item.description = content(content('div.con table.table3')[1]).html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Alter Shanghai',
|
||||
link: root_url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const root_url = 'https://emi-nitta.net';
|
||||
|
||||
const config = {
|
||||
updates: {
|
||||
link: '/updates',
|
||||
title: 'Emi Nitta - Updates',
|
||||
description: 'Recent update of Emi Nitta official website',
|
||||
},
|
||||
|
||||
news: {
|
||||
link: '/contents/news',
|
||||
title: 'Emi Nitta - News',
|
||||
description: 'News of Emi Nitta',
|
||||
},
|
||||
};
|
||||
|
||||
const get_date = (o) => {
|
||||
let date;
|
||||
const match = /(\d{4}\.\d+\.\d+)/.exec(o.text().trim());
|
||||
if (match) {
|
||||
date = match[1];
|
||||
} else {
|
||||
date = o.attr('datetime');
|
||||
}
|
||||
return new Date(date + ' GMT+9').toUTCString();
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cfg = config[ctx.params.type];
|
||||
if (!cfg) {
|
||||
throw Error('Bad type');
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url.resolve(root_url, cfg.link),
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('article.details ul.list-unstyled li a')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('div.title h3').text(),
|
||||
link: item.attr('href'),
|
||||
pubDate: get_date(item.find('time')),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet('emi-nitta' + item.link, async () => {
|
||||
const res = await got({ method: 'get', url: url.resolve(root_url, item.link) });
|
||||
const content = cheerio.load(res.data);
|
||||
|
||||
item.description = content('article.details div.body').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: cfg.title,
|
||||
description: cfg.description,
|
||||
link: root_url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user