forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route): 增加了六个美国博物馆的展讯 (DIYgod#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 <[email protected]> * Update lib/v2/guggenheim/exhibitions.js Co-authored-by: Tony <[email protected]> * Update docs/en/travel.md Co-authored-by: Tony <[email protected]> * Update docs/travel.md Co-authored-by: Tony <[email protected]> Co-authored-by: Tony <[email protected]>
- Loading branch information
Showing
26 changed files
with
313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
'brooklynmuseum.org': { | ||
_name: 'Brooklyn Museum', | ||
www: [ | ||
{ | ||
title: 'Exhibitions', | ||
docs: 'https://docs.rsshub.app/en/travel.html#brooklyn-museum', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions/:state?', require('./exhibitions')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
})), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions', require('./exhibitions')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
'thejewishmuseum.org': { | ||
_name: 'Jewish Museum', | ||
'.': [ | ||
{ | ||
title: 'Exhibitions', | ||
docs: 'https://docs.rsshub.app/en/travel.html#the-jewish-museum', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions', require('./exhibitions')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions', require('./exhibitions')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions/:state?', require('./exhibitions')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()`, | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/exhibitions': ['chazeon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
'newmuseum.org': { | ||
_name: 'New Museum', | ||
www: [ | ||
{ | ||
title: 'Exhibitions', | ||
docs: 'https://docs.rsshub.app/en/travel.html#new-museum', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/exhibitions', require('./exhibitions')); | ||
}; |