01 即刻-链接解析-分析

Wu Jun 2019-03-22 22:09:02
08 系统设计 > 2 业务设计

一、结果分析

1 判断

添加链接时,客户端本地判断,是否为合法链接

2 解析

添加链接之后请求后台解析

POST https://app.jike.ruguoapp.com/1.0/readability/extract

参数
字段 含义 必传
link 请求解析链接
返回
字段 含义 必传 返回值 解析失败默认值
link 请求链接 参数link
linkUrl 链接url 参数link
title 标题 解析的标题 参数link
abstract 摘要 解析的摘要 “分享一个链接”
pictureUrl 摘要 解析的图片

3 发布

POST https://app.jike.ruguoapp.com/1.0/originalPosts/create

参数
字段 含义 必传
title 标题
linkUrl 链接url
abstract 摘要
pictureUrl 图片
返回
字段 含义 必传
title 标题
pictureUrl 图片
linkUrl 链接url
source 来源

4 浏览

POST https://app.jike.ruguoapp.com/1.0/personalUpdate/followingUpdates

“浏览”返回值中链接相关部分,与“发布”返回值相同

5 总结

  1. 解析前先校验链接合法性
  2. 链接请求超时和解析失败做相同处理,返回默认值
  3. 解析到的图片先上传到本地系统,返回给前端本地url,无图则不返回
  4. 信息流请求里若无图,会返回给前端默认图片

二、原始数据

1 解析链接

POST https://app.jike.ruguoapp.com/1.0/readability/extract

1.1 测试1——解析结果有图
参数
{
  "link": "https://www.zhihu.com/question/293392735/answer/488108615"
}
返回
{
    "success": true, 
    "data": {
        "type": "NORMAL", 
        "abstract": "分享一个链接", 
        "link": "https://www.zhihu.com/question/293392735/answer/488108615", 
        "linkUrl": "https://www.zhihu.com/question/293392735/answer/488108615", 
        "title": "有哪些演技长相俱佳却没有红的女演员?", 
        "pictureUrl": "https://article-meta.ruguoapp.com/9308566ede7270465a33d85981430d6f.jpg?imageView2/0/w/160/h/160/q/80"
    }
}
1.2 测试2——解析结果无图
参数
{
    "link": "http://zhihu.com"
}
返回
{
    "success": true, 
    "data": {
        "type": "NORMAL", 
        "abstract": "有问题,上知乎。知乎,可信赖的问答社区,以让每个人高效获得可信赖的解答为使命。知乎凭借认真、专业和友善的社区氛围,结构化、易获得的优质内容,基于问答的内容生产方式和独特的社区机制,吸引、聚集了各行各业中大量的亲历者、内行人、领域专家、领域爱好者,将高质量的内容透过人的节点来成规模地生产和分享。用户通过问答等交流方式建立信任和连接,打造和提升个人影响力,并发现、获得新机会。", 
        "link": "http://zhihu.com", 
        "linkUrl": "http://zhihu.com", 
        "title": "知乎 - 有问题,上知乎"
    }
}
1.3 测试3——解析无效链接
参数
{
    "link": "http://afsdgsdfhhsdf.cc"
}
返回
{
    "success": true, 
    "data": {
        "type": "NORMAL",
        "abstract": "分享一个链接", 
        "link": "http://afsdgsdfhhsdf.cc", 
        "linkUrl": "http://afsdgsdfhhsdf.cc", 
        "title": "http://afsdgsdfhhsdf.cc",
    }
}

2 发布动态

2.1 测试1——解析结果有图

POST https://app.jike.ruguoapp.com/1.0/originalPosts/create

参数
{
    "coord": {
        "lat": "39.98205780548341", 
        "lng": "116.31948584159522", 
        "coordType": "wgs84"
    }, 
    "pictureKeys": [ ], 
    "content": "", 
    "syncToPersonalUpdate": true, 
    "linkInfo": {
        "type": "NORMAL", 
        "supplementary": false, 
        "linkUrl": "https://www.zhihu.com/question/293392735/answer/488108615", 
        "pictureUrl": "https://article-meta.ruguoapp.com/9308566ede7270465a33d85981430d6f.jpg?imageView2/0/w/160/h/160/q/80", 
        "abstract": "分享一个链接", 
        "urlsInText": [ ], 
        "title": "有哪些演技长相俱佳却没有红的女演员?"
    }
}
返回
{
    "success": true, 
    "toast": "发送成功", 
    "data": {
        "id": "5c6e6cd7e044ba00117d161c", 
        "type": "ORIGINAL_POST", 
        "content": "", 
        "urlsInText": [ ], 
        "status": "NORMAL", 
        "isCommentForbidden": false, 
        "likeCount": 0, 
        "commentCount": 0, 
        "repostCount": 0, 
        "shareCount": 0, 
        "linkInfo": {
            "title": "有哪些演技长相俱佳却没有红的女演员?", 
            "pictureUrl": "https://article-meta.ruguoapp.com/9308566ede7270465a33d85981430d6f.jpg?imageView2/0/w/160/h/160/q/80", 
            "linkUrl": "https://www.zhihu.com/question/293392735/answer/488108615", 
            "source": "zhihu.com"
        }, 
        "pictures": [ ], 
        "collected": false, 
        "collectTime": null, 
        "user": {
            "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
            "screenName": "述农", 
            "createdAt": "2019-02-20T16:00:00.000Z", 
            "updatedAt": "2019-02-21T08:53:02.055Z", 
            "isVerified": false, 
            "verifyMessage": "", 
            "briefIntro": "", 
            "avatarImage": {
                "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
                "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
                "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
                "badgeUrl": ""
            }, 
            "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "trailingIcons": [ ], 
            "statsCount": {
                "topicSubscribed": 8, 
                "topicCreated": 0, 
                "followedCount": 1, 
                "followingCount": 0, 
                "highlightedPersonalUpdates": 0, 
                "liked": 0
            }, 
            "backgroundImage": {
                "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
            }, 
            "gender": "MALE"
        }, 
        "createdAt": "2019-02-21T09:18:15.798Z", 
        "isFeatured": false
    }
}
2.2 测试2——解析结果无图
参数
{
    "coord": {
        "lat": "39.98207405382589", 
        "lng": "116.31953478846214", 
        "coordType": "wgs84"
    }, 
    "pictureKeys": [ ], 
    "content": "test", 
    "syncToPersonalUpdate": true, 
    "linkInfo": {
        "type": "NORMAL", 
        "title": "知乎 - 有问题,上知乎", 
        "abstract": "有问题,上知乎。知乎,可信赖的问答社区,以让每个人高效获得可信赖的解答为使命。知乎凭借认真、专业和友善的社区氛围,结构化、易获得的优质内容,基于问答的内容生产方式和独特的社区机制,吸引、聚集了各行各业中大量的亲历者、内行人、领域专家、领域爱好者,将高质量的内容透过人的节点来成规模地生产和分享。用户通过问答等交流方式建立信任和连接,打造和提升个人影响力,并发现、获得新机会。", 
        "linkUrl": "http://zhihu.com", 
        "supplementary": false, 
        "urlsInText": [ ]
    }
}


返回
{
    "success": true, 
    "toast": "发送成功", 
    "data": {
        "id": "5c6e74e07eb3e20012c052eb", 
        "type": "ORIGINAL_POST", 
        "content": "test", 
        "urlsInText": [ ], 
        "status": "NORMAL", 
        "isCommentForbidden": false, 
        "likeCount": 0, 
        "commentCount": 0, 
        "repostCount": 0, 
        "shareCount": 0, 
        "linkInfo": {
            "title": "知乎 - 有问题,上知乎", 
            "pictureUrl": "https://cdn.ruguoapp.com/icons/link.png", 
            "linkUrl": "http://zhihu.com", 
            "source": "zhihu.com"
        }, 
        "pictures": [ ], 
        "collected": false, 
        "collectTime": null, 
        "user": {
            "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
            "screenName": "述农", 
            "createdAt": "2019-02-20T16:00:00.000Z", 
            "updatedAt": "2019-02-21T08:53:02.055Z", 
            "isVerified": false, 
            "verifyMessage": "", 
            "briefIntro": "", 
            "avatarImage": {
                "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
                "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
                "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
                "badgeUrl": ""
            }, 
            "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "trailingIcons": [ ], 
            "statsCount": {
                "topicSubscribed": 8, 
                "topicCreated": 0, 
                "followedCount": 1, 
                "followingCount": 0, 
                "highlightedPersonalUpdates": 0, 
                "liked": 0
            }, 
            "backgroundImage": {
                "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
            }, 
            "gender": "MALE"
        }, 
        "createdAt": "2019-02-21T09:52:32.245Z", 
        "isFeatured": false
    }
}
2.3 测试3——解析无效链接
参数
{
    "coord": {
        "lat": "39.98205708164765", 
        "lng": "116.31944539176108", 
        "coordType": "wgs84"
    }, 
    "pictureKeys": [ ], 
    "content": "", 
    "syncToPersonalUpdate": true, 
    "linkInfo": {
        "type": "NORMAL", 
        "title": "http://gggggsjdjkdfiis.cc", 
        "abstract": "分享一个链接", 
        "linkUrl": "http://gggggsjdjkdfiis.cc", 
        "supplementary": false, 
        "urlsInText": [ ]
    }
}
返回
{
    "success": true, 
    "toast": "发送成功", 
    "data": {
        "id": "5c6e7641edfd9200128f700c", 
        "type": "ORIGINAL_POST", 
        "content": "", 
        "urlsInText": [ ], 
        "status": "NORMAL", 
        "isCommentForbidden": false, 
        "likeCount": 0, 
        "commentCount": 0, 
        "repostCount": 0, 
        "shareCount": 0, 
        "linkInfo": {
            "title": "http://gggggsjdjkdfiis.cc", 
            "pictureUrl": "https://cdn.ruguoapp.com/icons/link.png", 
            "linkUrl": "http://gggggsjdjkdfiis.cc", 
            "source": "gggggsjdjkdfiis.cc"
        }, 
        "pictures": [ ], 
        "collected": false, 
        "collectTime": null, 
        "user": {
            "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
            "screenName": "述农", 
            "createdAt": "2019-02-20T16:00:00.000Z", 
            "updatedAt": "2019-02-21T08:53:02.055Z", 
            "isVerified": false, 
            "verifyMessage": "", 
            "briefIntro": "", 
            "avatarImage": {
                "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
                "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
                "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
                "badgeUrl": ""
            }, 
            "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "trailingIcons": [ ], 
            "statsCount": {
                "topicSubscribed": 8, 
                "topicCreated": 0, 
                "followedCount": 1, 
                "followingCount": 0, 
                "highlightedPersonalUpdates": 0, 
                "liked": 0
            }, 
            "backgroundImage": {
                "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
            }, 
            "gender": "MALE"
        }, 
        "createdAt": "2019-02-21T09:58:25.053Z", 
        "isFeatured": false
    }
}

3 信息流

POST https://app.jike.ruguoapp.com/1.0/personalUpdate/followingUpdates

3.1 —解析结果有图
{
    "actionTime": "2019-02-21T09:18:15.000Z", 
    "id": "5c6e6cd7e044ba00117d161c", 
    "type": "ORIGINAL_POST", 
    "content": "", 
    "urlsInText": [ ], 
    "status": "NORMAL", 
    "isCommentForbidden": false, 
    "likeCount": 0, 
    "commentCount": 0, 
    "repostCount": 0, 
    "shareCount": 0, 
    "linkInfo": {
        "title": "有哪些演技长相俱佳却没有红的女演员?", 
        "pictureUrl": "https://article-meta.ruguoapp.com/9308566ede7270465a33d85981430d6f.jpg?imageView2/0/w/160/h/160/q/80", 
        "linkUrl": "https://www.zhihu.com/question/293392735/answer/488108615", 
        "source": "zhihu.com"
    }, 
    "pictures": [ ], 
    "collected": false, 
    "collectTime": null, 
    "user": {
        "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
        "screenName": "述农", 
        "createdAt": "2019-02-20T16:00:00.000Z", 
        "updatedAt": "2019-02-21T08:53:02.055Z", 
        "isVerified": false, 
        "verifyMessage": "", 
        "briefIntro": "", 
        "avatarImage": {
            "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
            "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
            "badgeUrl": ""
        }, 
        "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
        "trailingIcons": [ ], 
        "statsCount": {
            "topicSubscribed": 8, 
            "topicCreated": 0, 
            "followedCount": 1, 
            "followingCount": 0, 
            "highlightedPersonalUpdates": 0, 
            "liked": 0
        }, 
        "backgroundImage": {
            "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
        }, 
        "gender": "MALE", 
        "ref": "FOLLOWINGS_FEED"
    }, 
    "createdAt": "2019-02-21T09:18:15.798Z", 
    "isFeatured": false, 
    "readTrackInfo": {
        "feedType": "FOLLOWING_UPDATES"
    }
}
3.2 —解析结果无图
 {
    "actionTime": "2019-02-21T09:52:32.000Z", 
    "id": "5c6e74e07eb3e20012c052eb", 
    "type": "ORIGINAL_POST", 
    "content": "test", 
    "urlsInText": [ ], 
    "status": "NORMAL", 
    "isCommentForbidden": false, 
    "likeCount": 0, 
    "commentCount": 0, 
    "repostCount": 0, 
    "shareCount": 0, 
    "linkInfo": {
        "title": "知乎 - 有问题,上知乎", 
        "pictureUrl": "https://cdn.ruguoapp.com/icons/link.png", 
        "linkUrl": "http://zhihu.com", 
        "source": "zhihu.com"
    }, 
    "pictures": [ ], 
    "collected": false, 
    "collectTime": null, 
    "user": {
        "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
        "screenName": "述农", 
        "createdAt": "2019-02-20T16:00:00.000Z", 
        "updatedAt": "2019-02-21T08:53:02.055Z", 
        "isVerified": false, 
        "verifyMessage": "", 
        "briefIntro": "", 
        "avatarImage": {
            "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
            "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
            "badgeUrl": ""
        }, 
        "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
        "trailingIcons": [ ], 
        "statsCount": {
            "topicSubscribed": 8, 
            "topicCreated": 0, 
            "followedCount": 1, 
            "followingCount": 0, 
            "highlightedPersonalUpdates": 0, 
            "liked": 0
        }, 
        "backgroundImage": {
            "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
        }, 
        "gender": "MALE", 
        "ref": "FOLLOWINGS_FEED"
    }, 
    "createdAt": "2019-02-21T09:52:32.245Z", 
    "isFeatured": false, 
    "readTrackInfo": {
        "feedType": "FOLLOWING_UPDATES"
    }
},
3.3 —解析无效参数
{
    "actionTime": "2019-02-21T09:40:39.000Z", 
    "id": "5c6e7217bfc3a20011aa2d9b", 
    "type": "ORIGINAL_POST", 
    "content": "", 
    "urlsInText": [ ], 
    "status": "NORMAL", 
    "isCommentForbidden": false, 
    "likeCount": 0, 
    "commentCount": 0, 
    "repostCount": 0, 
    "shareCount": 0, 
    "linkInfo": {
        "title": "http://afsdgsdfhhsdf.cc", 
        "pictureUrl": "https://cdn.ruguoapp.com/icons/link.png", 
        "linkUrl": "http://afsdgsdfhhsdf.cc", 
        "source": "afsdgsdfhhsdf.cc"
    }, 
    "pictures": [ ], 
    "collected": false, 
    "collectTime": null, 
    "user": {
        "username": "C325FD48-3B15-4E59-AC23-04F70E254166", 
        "screenName": "述农", 
        "createdAt": "2019-02-20T16:00:00.000Z", 
        "updatedAt": "2019-02-21T08:53:02.055Z", 
        "isVerified": false, 
        "verifyMessage": "", 
        "briefIntro": "", 
        "avatarImage": {
            "thumbnailUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
            "smallPicUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/300/h/300/q/100!", 
            "picUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/800/h/800", 
            "badgeUrl": ""
        }, 
        "profileImageUrl": "https://cdn.ruguoapp.com/FqVks8Ii-VeeGMpe-dSLGg0DyZWX?imageView2/0/w/120/h/120/q/100!", 
        "trailingIcons": [ ], 
        "statsCount": {
            "topicSubscribed": 8, 
            "topicCreated": 0, 
            "followedCount": 1, 
            "followingCount": 0, 
            "highlightedPersonalUpdates": 0, 
            "liked": 0
        }, 
        "backgroundImage": {
            "picUrl": "https://cdn.ruguoapp.com/Fub9yOoFAesBAs9ci7GGdnoHgaEn.jpg?imageView2/0/w/800/h/800"
        }, 
        "gender": "MALE", 
        "ref": "FOLLOWINGS_FEED", 
        "following": false
    }, 
    "createdAt": "2019-02-21T09:40:39.300Z", 
    "isFeatured": false, 
    "readTrackInfo": {
        "feedType": "FOLLOWING_UPDATES"
    }
}