feat(route): 增加了六个美国博物馆的展讯 (#9451)
* Add New York Museums with working code * Add Guggenheim and fix Jewish Museum * Add pubDate for Gugg and Met Exhibitions * Update docs * Add New Museum and MCA Chicago, update document * Fix en route * Add and update radar.js * Add Brooklyn Museum * Reformat code * Update route and travel information * Fix `http` -> `https` for `radar.js` * Change some link quotations mark * Using `parseDate` provided by the project * Removing "insecureHTTPParser" * Fix JewishMuseum issue * Use regex instead of node's vm * Update lib/v2/jewishmuseum/exhibitions.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/guggenheim/exhibitions.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update docs/en/travel.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update docs/travel.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
parent
19608abd31
commit
b17eaf9848
|
|
@ -20,6 +20,14 @@ If the city name contains a space like `Mexico City`, replace the space with `%2
|
|||
|
||||
</RouteEn>
|
||||
|
||||
## Brooklyn Museum
|
||||
|
||||
<RouteEn author="chazeon"
|
||||
example="/brooklynmuseum/exhibitions"
|
||||
path="/brooklynmuseum/exhibitions/:state?"
|
||||
:paramsDesc="['state of the exhibition: `current`,`past`, or `upcoming`, the default value is `current`']"
|
||||
/>
|
||||
|
||||
## Hopper
|
||||
|
||||
### Flight Deals
|
||||
|
|
@ -31,3 +39,27 @@ This route returns a list of flight deals (in most cases, 6 flight deals) for a
|
|||
For airport IATA code please refer to [Wikipedia List of airports by IATA code](https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_A)
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Museum of Contemporary Art Chicago
|
||||
|
||||
<RouteEn author="chazeon" example="/mcachicago/exhibitions" path="/mcachicago/exhibitions" />
|
||||
|
||||
## New Museum
|
||||
|
||||
<RouteEn author="chazeon" example="/newmuseum/exhibitions" path="/newmuseum/exhibitions" />
|
||||
|
||||
## Solomon R. Guggenheim Museum
|
||||
|
||||
<RouteEn author="chazeon" example="/guggenheim/exhibitions" path="/guggenheim/exhibitions" />
|
||||
|
||||
## The Jewish Museum
|
||||
|
||||
<RouteEn author="chazeon" example="/jewishmuseum/exhibitions" path="/jewishmuseum/exhibitions" />
|
||||
|
||||
## The Metropolitan Museum of Art
|
||||
|
||||
<RouteEn author="chazeon"
|
||||
example="/metmuseum/exhibitions"
|
||||
path="/metmusem/exhibitions/:state?"
|
||||
:paramsDesc="['state of the exhibition: `current`,`past`, or `upcoming`, the default value is `current`']" anticrawler="1"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -114,6 +114,38 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运
|
|||
|
||||
</Route>
|
||||
|
||||
## 纽约布鲁克林博物馆
|
||||
|
||||
<Route author="chazeon"
|
||||
example="/brooklynmuseum/exhibitions"
|
||||
path="/brooklynmuseum/exhibitions/:state?"
|
||||
:paramsDesc="['展览进行的状态:`current` 对应展览当前正在进行,`past` 对应过去的展览,`upcoming` 对应即将举办的展览,默认为 `current`']"
|
||||
/>
|
||||
|
||||
## 纽约大都会美术馆
|
||||
|
||||
<Route author="chazeon"
|
||||
example="/metmuseum/exhibitions"
|
||||
path="/metmusem/exhibitions/:state?"
|
||||
:paramsDesc="['展览进行的状态:`current` 对应展览当前正在进行,`past` 对应过去的展览,`upcoming` 对应即将举办的展览,默认为 `current`']" anticrawler="1"
|
||||
/>
|
||||
|
||||
## 纽约古根海姆基金会
|
||||
|
||||
<Route author="chazeon" example="/guggenheim/exhibitions" path="/guggenheim/exhibitions" />
|
||||
|
||||
## 纽约新美术馆
|
||||
|
||||
<Route author="chazeon" example="/newmuseum/exhibitions" path="/newmuseum/exhibitions" />
|
||||
|
||||
## 纽约犹太人博物馆
|
||||
|
||||
<Route author="chazeon" example="/jewishmuseum/exhibitions" path="/jewishmuseum/exhibitions" />
|
||||
|
||||
## 芝加哥当代艺术博物馆
|
||||
|
||||
<Route author="chazeon" example="/mcachicago/exhibitions" path="/mcachicago/exhibitions" />
|
||||
|
||||
## 中国美术馆
|
||||
|
||||
### 美术馆新闻
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
const buildData = require('@/utils/common-config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let link;
|
||||
const state = ctx.params.state;
|
||||
|
||||
switch (state) {
|
||||
case undefined:
|
||||
case 'current':
|
||||
link = 'https://www.brooklynmuseum.org/exhibitions/';
|
||||
break;
|
||||
default:
|
||||
link = `https://www.brooklynmuseum.org/exhibitions/${state}`;
|
||||
}
|
||||
|
||||
ctx.state.data = await buildData({
|
||||
link,
|
||||
url: link,
|
||||
title: 'Brooklyn Museum - Exhibitions',
|
||||
item: {
|
||||
item: '.exhibitions .image-card',
|
||||
title: `$('h2 > a, h3 > a').text()`,
|
||||
link: `$('h2 > a, h3 > a').attr('href')`,
|
||||
description: `$('h6').text()`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'brooklynmuseum.org': {
|
||||
_name: 'Brooklyn Museum',
|
||||
www: [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#brooklyn-museum',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions/:state?', require('./exhibitions'));
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.guggenheim.org/exhibitions';
|
||||
|
||||
const response = await got({
|
||||
url: link,
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
const code = cheerio.load(response.data)('#app-js-extra').html();
|
||||
const data = JSON.parse(code.match(/var bootstrap = ([^\n]*);/)[1]);
|
||||
const exhibitions = data.initial.main.posts.featuredExhibitions;
|
||||
const items = [].concat(exhibitions.past.items ?? [], exhibitions.on_view.items ?? [], exhibitions.upcoming.items ?? []);
|
||||
|
||||
ctx.state.data = {
|
||||
link,
|
||||
url: link,
|
||||
title: 'The Guggenheim Museums and Foundation - Exhibitions',
|
||||
item: items.map((ex) => ({
|
||||
title: ex.title,
|
||||
link: `https://www.guggenheim.org/exhibition/${ex.slug}`,
|
||||
description: ex.excerpt,
|
||||
pubDate: ex.dates ? parseDate(`${ex.dates.start.month} ${ex.dates.start.day}, ${ex.dates.start.year}`, 'MMMM D, YYYY') : null,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'guggenheim.org': {
|
||||
_name: 'Solomon R. Guggenheim Museum',
|
||||
www: [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#solomon-r-guggenheim-museum',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions', require('./exhibitions'));
|
||||
};
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
const buildData = require('@/utils/common-config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://thejewishmuseum.org/exhibitions';
|
||||
|
||||
ctx.state.data = await buildData({
|
||||
link,
|
||||
url: link,
|
||||
title: 'Jewish Museums - Exhibitions',
|
||||
item: {
|
||||
item: '#current article.exhibition, #upcoming article, #past article.exhibition',
|
||||
title: `$('article.exhibition h3').text()`,
|
||||
link: `$('article.exhibition > a').attr('href')`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'thejewishmuseum.org': {
|
||||
_name: 'Jewish Museum',
|
||||
'.': [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#the-jewish-museum',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions', require('./exhibitions'));
|
||||
};
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
const buildData = require('@/utils/common-config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://mcachicago.org/exhibitions';
|
||||
|
||||
ctx.state.data = await buildData({
|
||||
link,
|
||||
url: link,
|
||||
title: 'MCA Chicago - Exhibitions',
|
||||
item: {
|
||||
item: '#exhibitions .card',
|
||||
title: `$('.title').text()`,
|
||||
link: `$('a').attr('href')`,
|
||||
// description: `$('a').html()`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'mcachicago.org': {
|
||||
_name: 'MCA Chicago',
|
||||
'.': [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#museum-of-contemporary-art-chicago',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions', require('./exhibitions'));
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
function generateExhibitionItem(result) {
|
||||
return {
|
||||
title: result.title,
|
||||
link: `https://www.metmuseum.org${result.url}`,
|
||||
description: result.description,
|
||||
pubDate: parseDate(result.startDate),
|
||||
guid: result.id,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const searchType = ctx.params.state ?? 'current';
|
||||
|
||||
const url = `https://www.metmuseum.org/ghidorah/ExhibitionListing/Search?searchType=${searchType}`;
|
||||
|
||||
const response = await got({
|
||||
url,
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'The Metropolitan Museum of Art - Exhibitions',
|
||||
link: 'https://www.metmuseum.org/exhibitions',
|
||||
item: data.results.map(generateExhibitionItem),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'metmuseum.org': {
|
||||
_name: 'The Metropolitan Museum of Art',
|
||||
www: [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#the-metropolitan-museum-of-art',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions/:state?', require('./exhibitions'));
|
||||
};
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
const buildData = require('@/utils/common-config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let link;
|
||||
const state = ctx.query.state;
|
||||
|
||||
switch (state) {
|
||||
case undefined:
|
||||
case 'current':
|
||||
link = 'https://www.newmuseum.org/exhibitions/';
|
||||
break;
|
||||
default:
|
||||
link = `https://www.newmuseum.org/exhibitions/${state}`;
|
||||
}
|
||||
|
||||
ctx.state.data = await buildData({
|
||||
link,
|
||||
url: link,
|
||||
title: 'New Museum - Exhibitions',
|
||||
item: {
|
||||
item: '.exh',
|
||||
title: `$('.exh .title').text()`,
|
||||
link: `$('.exh > a').attr('href')`,
|
||||
description: `$('.exh .body-reveal').text()`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/exhibitions': ['chazeon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'newmuseum.org': {
|
||||
_name: 'New Museum',
|
||||
www: [
|
||||
{
|
||||
title: 'Exhibitions',
|
||||
docs: 'https://docs.rsshub.app/en/travel.html#new-museum',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/exhibitions', require('./exhibitions'));
|
||||
};
|
||||
Loading…
Reference in New Issue