feat: update Bailian model and improve TypeScript configuration

- Changed Bailian model from 'qwen3-235b-a22b' to 'qwen-plus' in ai.ts
- Updated model references in bailianModel to use simplified names
- Modified tsconfig.json to set module to NodeNext, target to esnext, and adjusted paths for better module resolution
- Added new query-keys.ts file in xhs package to implement getNoteByKeyword functionality with command line interface
This commit is contained in:
2025-12-25 04:53:24 +08:00
parent 52d37d0679
commit 0d42e912f5
20 changed files with 772 additions and 593 deletions

View File

@@ -1,9 +1,7 @@
import axios from 'axios';
import qs from 'querystring';
import { get_xs } from './jsvmp/xhs';
import fs from 'fs';
import { getXCommon, getSearchId, SearchSortType, SearchNoteType } from './helper.js';
import { getSearchId, SearchSortType, SearchNoteType } from './helper.js';
import { ErrorEnum, DataFetchError, IPBlockError, SignError, NeedVerifyError } from './exception';
const camelToUnderscore = (key) => {
@@ -93,24 +91,6 @@ class XhsClient {
config.headers = newHeaders;
return config;
}
_preHeaders(url, data = null) {
let a1 = this.cookieDict.a1;
let b1 = '';
let x_s_result = get_xs(url, data, this.cookie);
const X_S = x_s_result['X-s'];
const X_t = x_s_result['X-t'].toString();
const X_S_COMMON = getXCommon(a1, b1, X_S, X_t);
return {
headers: {
'x-s': X_S,
'x-t': X_t,
// 'x-s-common': X_S_COMMON,
},
};
}
getXCommon(a1, b1, x_s, x_t) {
return getXCommon(a1, b1 || '', x_s, String(x_t));
}
getCookieMap() {
const cookie = this.cookie;
let cookieDict = {};
@@ -145,16 +125,6 @@ class XhsClient {
this.axiosInstance.defaults.headers.Cookie = cookieStr;
this.cookie = cookieStr;
}
/**
* Get X-S and X-T
* @param {*} url
* @param {*} data
* @param {*} cookie
* @returns
*/
get_xs(url, data, cookie) {
return get_xs(url, data, cookie);
}
async request(method, url, config = {}) {
try {
@@ -277,17 +247,17 @@ class XhsClient {
const endpoint = this.getEndpoint(config).endpoint;
config = await this.requestSign(uri, data, config);
this.printResult('post', { uri, data, config });
if (data) {
return this.request('POST', `${endpoint}${uri}`, {
...config,
data: jsonStr,
headers: {
...config.headers,
'Content-Type': 'application/json',
},
});
}
return this.request('POST', `${endpoint}${uri}`, { ...config, data });
// if (data) {
// return this.request('POST', `${endpoint}${uri}`, {
// ...config,
// data: jsonStr,
// headers: {
// ...config.headers,
// 'Content-Type': 'application/json',
// },
// });
// }
// return this.request('POST', `${endpoint}${uri}`, { ...config, data });
}
/**