feat: Ins的帐号简介和头像 (#2532)

* fix: 微博的description和image

* Add Instagram account's profile image URL.

Signed-off-by: WangJunyu <junyu.wang147@outlook.com>

* 修改帐号简介

* fix CI build failed

Signed-off-by: WangJunyu <junyu.wang147@outlook.com>
This commit is contained in:
Wang Junyu 2019-07-03 12:01:15 +08:00 committed by DIYgod
parent 01c22cee07
commit 9487b780cc
1 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id;
@ -15,8 +14,8 @@ module.exports = async (ctx) => {
const data = JSON.parse(response.data.match(/<script type="text\/javascript">window._sharedData = (.*);<\/script>/)[1]) || {};
const list = data.entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media.edges;
const name = data.entry_data.ProfilePage[0].graphql.user.full_name;
const $ = cheerio.load(response.data);
const profileImageUrl = data.entry_data.ProfilePage[0].graphql.user.profile_pic_url_hd;
const description = data.entry_data.ProfilePage[0].graphql.user.biography;
// retrieve media objects
const media = await Promise.all(
@ -69,7 +68,8 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: `${name}(@${id})'s Instagram`,
link: `https://www.instagram.com/${id}/`,
description: $('meta[name="description"]').attr('content'),
description: description,
image: profileImageUrl,
item: list.map((item, index) => {
item = item.node;
let image = 0;