|
| 1 | +/* eslint-disable no-console */ |
1 | 2 | const got = require('@/utils/got'); |
2 | 3 | const utils = require('./utils'); |
3 | 4 | const { parseDate } = require('@/utils/parse-date'); |
4 | | -const md5 = require('@/utils/md5'); |
5 | | -const g_encrypt = require('./execlib/g_encrypt'); |
| 5 | +const g_encrypt = require('./execlib/g_encrypt_3'); |
| 6 | +const zhihu_hash = require('./execlib/hash.js'); |
6 | 7 |
|
7 | 8 | module.exports = async (ctx) => { |
8 | 9 | const id = ctx.params.id; |
@@ -33,16 +34,16 @@ module.exports = async (ctx) => { |
33 | 34 | const cookie = `d_c0=${cookie_mes}`; |
34 | 35 |
|
35 | 36 | // second: get real data from zhihu |
36 | | - const apiPath = `/api/v4/web_moments/${id}/activities?limit=7&desktop=true`; |
| 37 | + const apiPath = `/api/v3/moments/${id}/activities?limit=7&desktop=true`; |
37 | 38 |
|
38 | 39 | // calculate x-zse-96, refer to https://github.com/srx-2000/spider_collection/issues/18 |
39 | | - const f = `101_3_2.0+${apiPath}+${cookie_mes}`; |
40 | | - const xzse96 = '2.0_' + g_encrypt(md5(f)); |
41 | | - const _header = { cookie, 'x-zse-96': xzse96, 'x-app-za': 'OS=Web', 'x-zse-93': '101_3_2.0' }; |
| 40 | + const f = `101_3_3.0+${apiPath}+${cookie_mes}`; |
| 41 | + const xzse96 = '2.0_' + g_encrypt(zhihu_hash(f)); |
| 42 | + const _header = { cookie, 'x-zse-96': xzse96, 'x-app-za': 'OS=Web', 'x-zse-93': '101_3_3.0' }; |
42 | 43 |
|
43 | 44 | const response = await got({ |
44 | 45 | method: 'get', |
45 | | - url: `https://www.zhihu.com/api/v4/web_moments/${id}/activities?limit=7&desktop=true`, |
| 46 | + url: `https://www.zhihu.com/api/v3/moments/${id}/activities?limit=7&desktop=true`, |
46 | 47 | headers: { |
47 | 48 | ...utils.header, |
48 | 49 | ..._header, |
|
0 commit comments