feat: add 猫耳FM最新广播剧 (#6345)

This commit is contained in:
Ethan Shen
2020-12-06 18:08:40 +00:00
committed by GitHub
parent b0e7d38376
commit 221eefebac
3 changed files with 52 additions and 0 deletions
+4
View File
@@ -603,6 +603,10 @@ pageClass: routes
<Route author="FlashWingShadow" example="/missevan/drama/28499" path="/missevan/drama/:id" :paramsDesc="['剧集 id,在剧集主页 URL 中可以找到']"/>
### 最新广播剧
<Route author="nczitzk" example="/missevan/drama/latest" path="/missevan/drama/latest"/>
## 猫眼电影
### 正在热映
+1
View File
@@ -3073,6 +3073,7 @@ router.get('/amazfitwatchfaces/top/:model/:type?/:time?/:sortBy?/:lang?', requir
router.get('/amazfitwatchfaces/search/:model/:keyword?/:sortBy?', require('./routes/amazfitwatchfaces/search'));
// 猫耳FM
router.get('/missevan/drama/latest', require('./routes/missevan/latest'));
router.get('/missevan/drama/:id', require('./routes/missevan/drama'));
// Go语言爱好者周刊
+47
View File
@@ -0,0 +1,47 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const link = `https://www.missevan.com/dramaapi/filter?filters=0_0_0_0_0&page=1&order=1&page_size=20`;
const response = await got({
method: 'get',
url: link,
});
const items = await Promise.all(
response.data.info.Datas.map(async (item) => {
const dramaUrl = `https://www.missevan.com/dramaapi/getdrama?drama_id=${item.id}`;
const dramaResponse = await got({
method: 'get',
url: dramaUrl,
});
try {
const soundUrl = `https://www.missevan.com/sound/getsound?soundid=${dramaResponse.data.info.episodes.episode[0].sound_id}`;
const soundResponse = await got({
method: 'get',
url: soundUrl,
});
const soundData = soundResponse.data.info.sound;
return {
title: item.name + (item.integrity === 3 ? '(已完结)' : '(更新至 ' + item.newest + ')'),
enclosure_url: soundData.soundurl,
enclosure_length: soundData.duration,
enclosure_type: 'audio/mpeg',
image: item.cover,
itunes_author: soundData.username,
itunes_category: '',
link: `https://www.missevan.com/sound/player?id=${dramaResponse.data.info.episodes.episode[0].sound_id}`,
description: `<img src=${item.cover}><br>${soundData.intro}`,
pubDate: new Date(soundData.last_update_time * 1000).toUTCString(),
};
} catch (err) {
return Promise.resolve('');
}
})
);
ctx.state.data = {
title: `猫耳FM - 最新广播剧`,
link: `https://www.missevan.com/mdrama`,
item: items,
};
};