add maitta route (#1725)

* add maitta route

* 更换请求源
This commit is contained in:
fengkx
2019-03-12 14:46:01 +08:00
committed by DIYgod
parent 5eab3a4a69
commit 03f47d9400
3 changed files with 57 additions and 0 deletions

View File

@@ -3136,6 +3136,10 @@ type 为 all 时category 参数不支持 cost 和 free
<route name="最新资讯" author="WenryXu" example="/juesheng" path="/juesheng"/> <route name="最新资讯" author="WenryXu" example="/juesheng" path="/juesheng"/>
### 播客 IBC 岩手放送| IBC ラジオ イヤーマイッタマイッタ
<route name="IBC岩手放送IBCラジオ イヤーマイッタマイッタ" author="fengkx" example="/maitta" path="/maitta" />
### 博客: 敬维 ### 博客: 敬维
<route name="博客: 敬维" author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/> <route name="博客: 敬维" author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>

View File

@@ -1125,6 +1125,9 @@ router.get('/luogu/daily/:id?', require('./routes/luogu/daily'));
// 决胜网 // 决胜网
router.get('/juesheng', require('./routes/juesheng')); router.get('/juesheng', require('./routes/juesheng'));
// 播客IBCラジオ イヤーマイッタマイッタ
router.get('/maitta', require('./routes/maitta'));
// 一些博客 // 一些博客
// 敬维-以认真的态度做完美的事情: https://jingwei.link/ // 敬维-以认真的态度做完美的事情: https://jingwei.link/
router.get('/blogs/jingwei.link', require('./routes/blogs/jingwei_link')); router.get('/blogs/jingwei.link', require('./routes/blogs/jingwei_link'));

View File

@@ -0,0 +1,50 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const url = 'https://www.ibc.co.jp/radio/maitta/audio/';
module.exports = async (ctx) => {
const res = await axios.get(url);
const $ = cheerio.load(res.data);
const items = $('.broadcast').get();
ctx.state.data = {
title: 'IBCラジオ イヤーマイッタマイッタIBC岩手放送',
link: 'http://www.ibc.co.jp/radio/maitta/audio',
description: $('meta[name=description]').attr('content'),
itunes_author: '水越アナと大塚アナ',
image: 'https://cdn.ibc.co.jp/radio/maitta/audio/images/og.png',
language: 'ja',
item: items.map((item) => {
item = $(item);
return {
title: item.find('h3').text(),
description: item
.find('.linecontent')
.text()
.trim(),
link: `https:${
item
.find('a')
.first()
.attr('href')
.split('?')[0]
}`,
pubDate: new Date(
item
.find('.onairdate')
.text()
.split('日')[0]
.replace(/年|月/g, '-')
).toUTCString(),
itunes_item_image: 'https://cdn.ibc.co.jp/radio/maitta/audio/images/og.png',
enclosure_url: `https:${
item
.find('a')
.first()
.attr('href')
.split('?')[0]
}`, // 音频链接
enclosure_type: 'audio/mpeg',
};
}),
};
};