fix(route): 上海市药品监督管理局 (#10205)
This commit is contained in:
parent
d8c3126570
commit
967492dcaa
|
|
@ -21,25 +21,31 @@ module.exports = async (ctx) => {
|
|||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const link = item.attr('href');
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
pubDate: parseDate(item.next().text()),
|
||||
link: /^http/.test(link) ? link : `${rootUrl}${link}`,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
try {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('#ivs_content').html();
|
||||
item.pubDate = timezone(parseDate(content('meta[name="pubdate"]').attr('content')), +8);
|
||||
item.description = content('#ivs_content').html();
|
||||
item.pubDate = timezone(parseDate(content('meta[name="pubdate"]').attr('content')), +8);
|
||||
} catch (e) {
|
||||
// no-empty
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue