Files
RSSHub/lib/routes/maitta/index.js
fengkx 03f47d9400 add maitta route (#1725)
* add maitta route

* 更换请求源
2019-03-12 14:46:01 +08:00

51 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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',
};
}),
};
};