diff --git a/routes/instagram/user.js b/routes/instagram/user.js index 49879ea19..2f9c6dc85 100644 --- a/routes/instagram/user.js +++ b/routes/instagram/user.js @@ -18,11 +18,37 @@ module.exports = async (ctx) => { const $ = cheerio.load(response.data); + // 获取组图 + const images = await Promise.all( + list.map(async (item) => { + item = item.node; + if (item.__typename === 'GraphSidecar') { + const url = `https://www.instagram.com/p/${item.shortcode}`; + + const cache = await ctx.cache.get(url); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + const response = await axios({ + method: 'get', + url, + }); + const data = JSON.parse(response.data.match(/