爬取掘金热门文章
主要是掘金传输数据分析,并没有几行代码╮(╯▽╰)╭
6/5: 代码补上了
测试的参数列表
url_entry | 后端 | 安卓 | 前端 |
---|---|---|---|
src | web | web | web |
limit | 20 | 20 | 20 |
category | 5562b419e4b00c57d9b94ae2 | 5562b410e4b00c57d9b94a92 | 5562b415e4b00c57d9b94ac8 |
url_punch | |||
sub_location | backend | android | frontend |
location | welcome | welcome | welcome |
suid | J3rzUv6EaFYYfem2QFZQ | J3rzUv6EaFYYfem2QFZQ | J3rzUv6EaFYYfem2QFZQ |
src | juejin.im | juejin.im | juejin.im |
检查掘金的网络请求可以发现有三个链接很可疑
$url_entry = 'https://timeline-merger-ms.juejin.im/v1/get_entry_by_rank';
$url_punch = 'https://ubc-api-ms.juejin.im/v1/punch';
$url_recommend = 'https://recommender-api-ms.juejin.im/v1/get_recommended_entry?suid=J3rzUv6EaFYYfem2QFZQ&ab=welcome_3&src=web';
punch链接没有返回有用的信息,暂不分析(虽然它的参数列表看起来最正常)。
get_recommend_entry链接返回json结构
【仅d元素和tags元素为array,其余皆为object】
- d
- 0
- collectionCount
- commentCount
- gfw
- objectId
- subscribersCount
- ngxCachedTime
- recommenderInfo
- filtered
- source
- score
- tags 【此文章所属的所有技术分类】
- 0
- title 【技术分类?】
- ngxCached
- ngxCachedTime 【某种顺序编号】
- id
- …
- title 【文章标题】
- content 【文章首句】
- type
- updatedAt
- entryView
- rankIndex
- author
- category 【文章分类】
- ngxCached
- title
- id
- name 【方向分类?】
- ngxCachedTime
- originalUrl 【原始URL,即原网站】
- buildTime 【记录时间?有四位小数】
- original
- user 【用户信息】
- avatarLarge 【头像链接】
- community 【社交信息,Github, 微信等】
- collectedEntriesCount
- company 【公司信息】
- followersCount 【关注的人数】
- followeesCount 【关注着人数】
- role
- subscribedTagsCount
- totalCollectionsCount 【“获得的喜欢”数】
- totalCommentsCount
- username 【用户名】
- viewedEntriesCount
- verifyCreatedAt 【创建事件】
- verifyStatus
- viewsCount 【总访问量】
- …
get_entry_by_rank返回json结构
- d
- entrylist
- 0
- author
- buildtime
- category 【分类】
- id
- name 【分类名称】
- ngxCached
- ngxCachedTime
- title 【分类名,英文版,可能用作get参数】
- checkStatus
- collectionCount
- commentsCount
- content 【内容片段】