diff --git a/lib/v2/bmkg/earthquake.js b/lib/v2/bmkg/earthquake.js index 63f5236dc..b1270cb4b 100644 --- a/lib/v2/bmkg/earthquake.js +++ b/lib/v2/bmkg/earthquake.js @@ -8,16 +8,16 @@ module.exports = async (ctx) => { const response = await got(url); const $ = cheerio.load(response.data); const items = $('div .table-responsive tbody tr') - .toArray() - .map((item) => { - item = $(item); - const td = item.find('td'); - return { - title: `${td[2].children[0].data}|${td[3].children[0].data}|${td[4].children[0].data}|${td[5].children[0].data}|${td[6].children[0].data}`, - link: url, - pubDate: timezone(parseDate(`${td[1].children[0].data} ${td[1].children[2].data.slice(0, 8)}`, 'DD-MM-YY HH:mm:ss'), +7) - }; - }); + .toArray() + .map((item) => { + item = $(item); + const td = item.find('td'); + return { + title: `${td[2].children[0].data}|${td[3].children[0].data}|${td[4].children[0].data}|${td[5].children[0].data}|${td[6].children[0].data}`, + link: url, + pubDate: timezone(parseDate(`${td[1].children[0].data} ${td[1].children[2].data.slice(0, 8)}`, 'DD-MM-YY HH:mm:ss'), +7), + }; + }); ctx.state.data = { title: $('title').text(), diff --git a/lib/v2/bmkg/news.js b/lib/v2/bmkg/news.js index 7b65ad1b9..8d1e5b578 100644 --- a/lib/v2/bmkg/news.js +++ b/lib/v2/bmkg/news.js @@ -6,22 +6,22 @@ module.exports = async (ctx) => { const response = await got(url); const $ = cheerio.load(response.data); const list = $('div .ms-slide') - .toArray() - .map((item) => { - item = $(item); - const a = item.find('a'); - const img = item.find('img'); + .toArray() + .map((item) => { + item = $(item); + const a = item.find('a'); + const img = item.find('img'); - return { - title: a.text(), - link: `${url}/${a.attr('href')}`, - itunes_item_image: img.attr('data-src') - }; - }); + return { + title: a.text(), + link: `${url}/${a.attr('href')}`, + itunes_item_image: img.attr('data-src'), + }; + }); const items = await Promise.all( list.map((item) => - ctx.cache.tryGet(item.link, async() => { + ctx.cache.tryGet(item.link, async () => { const response = await got(item.link); const $ = cheerio.load(response.data); const p = $('div .blog-grid').find('p'); diff --git a/lib/v2/bmkg/radar.js b/lib/v2/bmkg/radar.js index 78653fab1..997d0ca2c 100644 --- a/lib/v2/bmkg/radar.js +++ b/lib/v2/bmkg/radar.js @@ -6,13 +6,13 @@ module.exports = { title: '最近的地震', docs: 'https://docs.rsshub.app/new-media.html#BMKG-yin-ni-qi-xiang-qi-hou-he-di-qiu-wu-li-ju', source: ['/', '/gempabumi-terkini.html'], - target: '/bmkg/earthquake' + target: '/bmkg/earthquake', }, { title: '新闻', docs: 'https://docs.rsshub.app/new-media.html#BMKG-yin-ni-qi-xiang-qi-hou-he-di-qiu-wu-li-ju', source: ['/', '/berita'], - target: '/bmkg/news' + target: '/bmkg/news', }, ], },