mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-28 23:19:27 +08:00
feat: add The Argument Audio from the Supreme Court of the United States (#6127)
Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
@@ -10,6 +10,12 @@ pageClass: routes
|
||||
|
||||
<RouteEn author="sgqy" example="/go.jp/mofa" path="/go.jp/mofa"/>
|
||||
|
||||
## Supreme Court of the United States
|
||||
|
||||
### Arguments Audios
|
||||
|
||||
<RouteEn author="nczitzk" example="/us/supremecourt/argument_audio" path="/us/supremecourt/argument_audio/:year?" :paramsDesc="['Year, current year by default']"/>
|
||||
|
||||
## United Nations
|
||||
|
||||
### Security Council Vetoed a Resolution
|
||||
|
||||
@@ -77,6 +77,12 @@ pageClass: routes
|
||||
|
||||
<Route author="HenryQW" example="/un/scveto" path="/un/scveto"/>
|
||||
|
||||
## 美国联邦最高法院
|
||||
|
||||
### 辩论音频
|
||||
|
||||
<Route author="nczitzk" example="/us/supremecourt/argument_audio" path="/us/supremecourt/argument_audio/:year?" :paramsDesc="['年份,默认为当前年份']"/>
|
||||
|
||||
## 泉州市跨境电子商务协会
|
||||
|
||||
### 新闻动态
|
||||
|
||||
@@ -3472,6 +3472,9 @@ router.get('/grandchallenge/challenges', require('./routes/grandchallenge/challe
|
||||
// 西北工业大学
|
||||
router.get('/nwpu/:column', require('./routes/nwpu/index'));
|
||||
|
||||
// 美国联邦最高法院
|
||||
router.get('/us/supremecourt/argument_audio/:year?', require('./routes/us/supremecourt/argument_audio'));
|
||||
|
||||
// 得到
|
||||
router.get('/dedao/list/:caty?', require('./routes/dedao/list'));
|
||||
router.get('/dedao/:caty?', require('./routes/dedao/index'));
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const year = ctx.params.year || new Date().getFullYear();
|
||||
|
||||
const rootUrl = 'https://www.supremecourt.gov';
|
||||
const imageUrl = `${rootUrl}/images/scous_seal.png`;
|
||||
const currentUrl = `${rootUrl}/oral_arguments/argument_audio/${year}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.panel-body table tbody tr td span a')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}/oral_arguments${item.attr('href').replace('..', '')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('#pagetitle').remove();
|
||||
|
||||
item.description = content('#pagemaindiv').html();
|
||||
item.title += ` : ${content('#ctl00_ctl00_MainEditable_mainContent_lblCaseName').text()}`;
|
||||
item.pubDate = new Date(content('#ctl00_ctl00_MainEditable_mainContent_lblDate').text() + ' GMT-5').toUTCString();
|
||||
|
||||
item.itunes_item_image = imageUrl;
|
||||
item.enclosure_url = content('audio source').attr('src');
|
||||
item.enclosure_type = 'audio/mpeg';
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Argument Audio ${year} - Supreme Court of the United States`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
itunes_author: 'Supreme Court of the United States',
|
||||
image: imageUrl,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user