@open-dy/ai_coding_sdk 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +38 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -0
- package/dist/openapi/account/ai_data.d.ts +20 -0
- package/dist/openapi/account/ai_data.js +7 -0
- package/dist/openapi/account/ai_items.d.ts +22 -0
- package/dist/openapi/account/ai_items.js +7 -0
- package/dist/openapi/account/ai_profile.d.ts +18 -0
- package/dist/openapi/account/ai_profile.js +7 -0
- package/dist/openapi/account/certification.d.ts +1 -0
- package/dist/openapi/account/certification.js +2 -0
- package/dist/openapi/account/device.d.ts +1 -0
- package/dist/openapi/account/device.js +2 -0
- package/dist/openapi/account/identity.d.ts +17 -0
- package/dist/openapi/account/identity.js +27 -0
- package/dist/openapi/account/index.d.ts +10 -0
- package/dist/openapi/account/index.js +14 -0
- package/dist/openapi/account/profile.d.ts +14 -0
- package/dist/openapi/account/profile.js +22 -0
- package/dist/openapi/account/realname.d.ts +1 -0
- package/dist/openapi/account/realname.js +2 -0
- package/dist/openapi/business/index.d.ts +1 -0
- package/dist/openapi/business/index.js +2 -0
- package/dist/openapi/comment/comment.d.ts +23 -0
- package/dist/openapi/comment/comment.js +15 -0
- package/dist/openapi/comment/index.d.ts +2 -0
- package/dist/openapi/comment/index.js +6 -0
- package/dist/openapi/content/follow.d.ts +37 -0
- package/dist/openapi/content/follow.js +15 -0
- package/dist/openapi/content/index.d.ts +6 -0
- package/dist/openapi/content/index.js +11 -0
- package/dist/openapi/content/recommend.d.ts +42 -0
- package/dist/openapi/content/recommend.js +7 -0
- package/dist/openapi/content/video.d.ts +12 -0
- package/dist/openapi/content/video.js +15 -0
- package/dist/openapi/core.d.ts +18 -0
- package/dist/openapi/core.js +119 -0
- package/dist/openapi/hot/hot.d.ts +15 -0
- package/dist/openapi/hot/hot.js +7 -0
- package/dist/openapi/hot/index.d.ts +2 -0
- package/dist/openapi/hot/index.js +5 -0
- package/dist/openapi/im/index.d.ts +1 -0
- package/dist/openapi/im/index.js +2 -0
- package/dist/openapi/index.d.ts +14 -0
- package/dist/openapi/index.js +35 -0
- package/dist/openapi/live/index.d.ts +1 -0
- package/dist/openapi/live/index.js +2 -0
- package/dist/openapi/platform/following.d.ts +14 -0
- package/dist/openapi/platform/following.js +16 -0
- package/dist/openapi/platform/index.d.ts +6 -0
- package/dist/openapi/platform/index.js +9 -0
- package/dist/openapi/platform/topic.d.ts +12 -0
- package/dist/openapi/platform/topic.js +16 -0
- package/dist/openapi/platform/user-basic.d.ts +20 -0
- package/dist/openapi/platform/user-basic.js +16 -0
- package/dist/openapi/relation/index.d.ts +1 -0
- package/dist/openapi/relation/index.js +2 -0
- package/dist/openapi/search/experience.d.ts +77 -0
- package/dist/openapi/search/experience.js +31 -0
- package/dist/openapi/search/general.d.ts +23 -0
- package/dist/openapi/search/general.js +15 -0
- package/dist/openapi/search/index.d.ts +16 -0
- package/dist/openapi/search/index.js +28 -0
- package/dist/openapi/search/live.d.ts +1 -0
- package/dist/openapi/search/live.js +2 -0
- package/dist/openapi/search/music.d.ts +35 -0
- package/dist/openapi/search/music.js +19 -0
- package/dist/openapi/search/poi.d.ts +47 -0
- package/dist/openapi/search/poi.js +12 -0
- package/dist/openapi/search/search.d.ts +138 -0
- package/dist/openapi/search/search.js +43 -0
- package/dist/openapi/search/user.d.ts +1 -0
- package/dist/openapi/search/user.js +2 -0
- package/dist/openapi/search/video.d.ts +1 -0
- package/dist/openapi/search/video.js +2 -0
- package/dist/openapi/search/vision.d.ts +37 -0
- package/dist/openapi/search/vision.js +50 -0
- package/dist/openapi/traffic/index.d.ts +1 -0
- package/dist/openapi/traffic/index.js +2 -0
- package/package.json +92 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface RecommendRequest {
|
|
3
|
+
count?: number;
|
|
4
|
+
reqId?: string;
|
|
5
|
+
timestamp?: number;
|
|
6
|
+
deviceInfo?: {
|
|
7
|
+
lang?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
osVersion?: string;
|
|
10
|
+
screenHeight?: number;
|
|
11
|
+
screenWidth?: number;
|
|
12
|
+
networkType?: string;
|
|
13
|
+
appVersion?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
};
|
|
16
|
+
userInfo?: {
|
|
17
|
+
oaid?: string;
|
|
18
|
+
userTag?: string;
|
|
19
|
+
};
|
|
20
|
+
sceneTag?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface RecommendItem {
|
|
23
|
+
contentId: string;
|
|
24
|
+
contentType: string;
|
|
25
|
+
title: string;
|
|
26
|
+
cover: string;
|
|
27
|
+
originalCover: string;
|
|
28
|
+
duration: number;
|
|
29
|
+
likedCount: number;
|
|
30
|
+
commentCount: number;
|
|
31
|
+
publishTime: number;
|
|
32
|
+
userId: string;
|
|
33
|
+
userName: string;
|
|
34
|
+
deeplink: string;
|
|
35
|
+
clickUrl: string;
|
|
36
|
+
exposureUrl: string;
|
|
37
|
+
sceneTag: string;
|
|
38
|
+
ecommerceWebcast: boolean;
|
|
39
|
+
exp: string;
|
|
40
|
+
}
|
|
41
|
+
export type RecommendResponse = RecommendItem[];
|
|
42
|
+
export declare function getRecommend(params: RecommendRequest, options?: CallOptions): Promise<OpenAPIResponse<RecommendResponse>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRecommend = getRecommend;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
async function getRecommend(params, options) {
|
|
6
|
+
return (0, core_1.callOpenAPI)({ path: '/api/douyin/ug/v1/recommend/', method: 'POST', body: params, domain: 'open.douyin.com' }, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface HighQualityTextParams {
|
|
3
|
+
item_id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface HighQualityTextResponse {
|
|
6
|
+
item_id: string;
|
|
7
|
+
high_quality_text: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 获取视频高质量文本
|
|
11
|
+
*/
|
|
12
|
+
export declare function getHighQualityText(params: HighQualityTextParams, options?: CallOptions): Promise<OpenAPIResponse<HighQualityTextResponse>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHighQualityText = getHighQualityText;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 获取视频高质量文本
|
|
7
|
+
*/
|
|
8
|
+
async function getHighQualityText(params, options) {
|
|
9
|
+
return (0, core_1.callOpenAPI)({
|
|
10
|
+
path: '/dy_open_api/item/get_high_quality_text/',
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: params,
|
|
13
|
+
domain: 'open.douyin.com',
|
|
14
|
+
}, options);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CallOpenAPIParams {
|
|
2
|
+
path: string;
|
|
3
|
+
method?: 'GET' | 'POST';
|
|
4
|
+
queryParams?: Record<string, string | number | undefined> | any;
|
|
5
|
+
body?: Record<string, unknown> | any;
|
|
6
|
+
domain?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CallOptions {
|
|
9
|
+
delegateToken?: string;
|
|
10
|
+
logid?: string;
|
|
11
|
+
ppeEnv?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenAPIResponse<T> {
|
|
14
|
+
err_no: number;
|
|
15
|
+
err_msg: string;
|
|
16
|
+
data: T;
|
|
17
|
+
}
|
|
18
|
+
export declare function callOpenAPI<T>(params: CallOpenAPIParams, options?: CallOptions): Promise<OpenAPIResponse<T>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 核心 OpenAPI 客户端 — 通用 HTTP 调用与基础类型
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.callOpenAPI = callOpenAPI;
|
|
5
|
+
/**
|
|
6
|
+
* 抖音开放平台 OpenAPI 域名与云调用域名映射。
|
|
7
|
+
*/
|
|
8
|
+
const CLOUD_CALL_DOMAIN_MAP = {
|
|
9
|
+
'open.douyin.com': 'open-douyin-com.openapi.dyc.ivolces.com',
|
|
10
|
+
'developer.toutiao.com': 'developer-toutiao-com.openapi.dyc.ivolces.com',
|
|
11
|
+
'minigame.zijieapi.com': 'minigame-zijieapi-com.openapi.dyc.ivolces.com',
|
|
12
|
+
'webcast.bytedance.com': 'webcast-bytedance-com.openapi.dyc.ivolces.com',
|
|
13
|
+
};
|
|
14
|
+
function isCloudEnvironment() {
|
|
15
|
+
return process.env.APP_ENV !== 'DEV';
|
|
16
|
+
}
|
|
17
|
+
function getCloudCallDomain(originalDomain) {
|
|
18
|
+
return CLOUD_CALL_DOMAIN_MAP[originalDomain] || originalDomain;
|
|
19
|
+
}
|
|
20
|
+
function buildUrl(path, queryParams, domain = 'open.douyin.com') {
|
|
21
|
+
const isCloud = isCloudEnvironment();
|
|
22
|
+
const finalDomain = isCloud ? getCloudCallDomain(domain) : domain;
|
|
23
|
+
const protocol = isCloud ? 'http' : 'https';
|
|
24
|
+
const url = new URL(`${protocol}://${finalDomain}${path}`);
|
|
25
|
+
if (queryParams) {
|
|
26
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
27
|
+
if (value !== undefined) {
|
|
28
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
29
|
+
url.searchParams.append(key, String(value));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
url.searchParams.append(key, JSON.stringify(value));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return url.toString();
|
|
38
|
+
}
|
|
39
|
+
function isFormDataBody(body) {
|
|
40
|
+
return typeof FormData !== 'undefined' && body instanceof FormData;
|
|
41
|
+
}
|
|
42
|
+
function buildHeaders(delegateToken, ppeEnv, extraHeaders = {}, body) {
|
|
43
|
+
const headers = isFormDataBody(body)
|
|
44
|
+
? { ...extraHeaders }
|
|
45
|
+
: { 'Content-Type': 'application/json', ...extraHeaders };
|
|
46
|
+
if (!isCloudEnvironment() && delegateToken) {
|
|
47
|
+
headers['access-token'] = delegateToken;
|
|
48
|
+
}
|
|
49
|
+
if (ppeEnv) {
|
|
50
|
+
headers['x-tt-env'] = ppeEnv;
|
|
51
|
+
headers['x-use-ppe'] = '1';
|
|
52
|
+
}
|
|
53
|
+
return headers;
|
|
54
|
+
}
|
|
55
|
+
function maskHeaders(headers) {
|
|
56
|
+
return {
|
|
57
|
+
...headers,
|
|
58
|
+
...(headers['access-token'] ? { 'access-token': '***' } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function callOpenAPI(params, options) {
|
|
62
|
+
const { path, method = 'GET', queryParams, body, domain = 'open.douyin.com', } = params;
|
|
63
|
+
const delegateToken = options?.delegateToken;
|
|
64
|
+
const envPpeEnv = process.env.APP_ENV?.startsWith('ppe_') ? process.env.APP_ENV : undefined;
|
|
65
|
+
const ppeEnv = options?.ppeEnv || envPpeEnv;
|
|
66
|
+
const extraHeaders = options?.logid ? { 'x-tt-logid': options.logid } : {};
|
|
67
|
+
const url = buildUrl(path, queryParams, domain);
|
|
68
|
+
const headers = buildHeaders(delegateToken, ppeEnv, extraHeaders, body);
|
|
69
|
+
console.log(`[OpenAPI] ${method} ${url}`);
|
|
70
|
+
console.log('[OpenAPI] Headers:', maskHeaders(headers), body);
|
|
71
|
+
console.log('[OpenAPI] Is Cloud Environment:', isCloudEnvironment());
|
|
72
|
+
const requestOptions = {
|
|
73
|
+
method,
|
|
74
|
+
headers,
|
|
75
|
+
};
|
|
76
|
+
if (body && method === 'POST') {
|
|
77
|
+
if (isFormDataBody(body)) {
|
|
78
|
+
requestOptions.body = body;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// 如果 body 已经是字符串,直接使用,不再进行 JSON.stringify
|
|
82
|
+
requestOptions.body = typeof body === 'string' ? body : JSON.stringify(body);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const response = await fetch(url, requestOptions);
|
|
87
|
+
const rawData = await response.json();
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
throw new Error(`HTTP Error: ${response.status} ${response.statusText}, x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
|
|
90
|
+
}
|
|
91
|
+
if (!rawData ||
|
|
92
|
+
typeof rawData !== 'object' ||
|
|
93
|
+
!("err_no" in rawData) ||
|
|
94
|
+
!("err_msg" in rawData)) {
|
|
95
|
+
throw new Error(`Invalid OpenAPI response, x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
|
|
96
|
+
}
|
|
97
|
+
const dataAny = rawData;
|
|
98
|
+
if (typeof dataAny.err_no === 'number' && dataAny.err_no !== 0) {
|
|
99
|
+
throw new Error(`OpenAPI Error: ${String(dataAny.err_msg)} (${String(dataAny.err_no)}), x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
|
|
100
|
+
}
|
|
101
|
+
const normalized = (() => {
|
|
102
|
+
if (dataAny.data !== undefined) {
|
|
103
|
+
return dataAny;
|
|
104
|
+
}
|
|
105
|
+
const { err_no, err_msg, ...rest } = dataAny;
|
|
106
|
+
return {
|
|
107
|
+
err_no: Number(err_no),
|
|
108
|
+
err_msg: String(err_msg),
|
|
109
|
+
data: rest,
|
|
110
|
+
};
|
|
111
|
+
})();
|
|
112
|
+
console.log('[OpenAPI] Response:', JSON.stringify(normalized).slice(0, 500));
|
|
113
|
+
return normalized;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('[OpenAPI Error]', error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface HotListParams {
|
|
3
|
+
cursor?: number;
|
|
4
|
+
count?: number;
|
|
5
|
+
type?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface HotBoardItem {
|
|
8
|
+
HotspotId: number;
|
|
9
|
+
HotCore: string;
|
|
10
|
+
Sentence: string;
|
|
11
|
+
}
|
|
12
|
+
export interface HotListResponse {
|
|
13
|
+
BoardList: HotBoardItem[];
|
|
14
|
+
}
|
|
15
|
+
export declare function getHotList(params: HotListParams, options?: CallOptions): Promise<OpenAPIResponse<HotListResponse>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHotList = getHotList;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
async function getHotList(params, options) {
|
|
6
|
+
return (0, core_1.callOpenAPI)({ path: '/dy_open_api/hot_list/', method: 'POST', body: params, domain: 'open.douyin.com' }, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { callOpenAPI } from './core';
|
|
2
|
+
export type { CallOpenAPIParams, CallOptions, OpenAPIResponse } from './core';
|
|
3
|
+
export { getUserConstellation, getRelatedId, getAffiliateId, getAIUserProfile, getAIUserDataInfo, getAIUserItemList } from './account';
|
|
4
|
+
export type { ConstellationResponse, GetRelatedIdRequest, GetRelatedIdResponse, AIUserProfileParams, AIUserInfo, AIUserProfileResponse, AIUserDataInfoParams, AIUserBase, AIUserDataInfoResponse, AIUserItemListParams, AIUserItem, AIUserItemListResponse } from './account';
|
|
5
|
+
export { getHighQualityText, getRecommend, getFollowHotWord, getFollowFeed, getFeed } from './content';
|
|
6
|
+
export type { HighQualityTextParams, HighQualityTextResponse, RecommendRequest, RecommendItem, RecommendResponse, HotWordUrl, HotWordItem, HotWordResponse, FollowFeedItem, FollowFeedResponse, FeedItem, FeedResponse } from './content';
|
|
7
|
+
export { searchVideo, searchUser, searchLive, searchExperience, searchMusic, searchGeneral, searchVision, searchPoi } from './search';
|
|
8
|
+
export type { VideoSearchParams, VideoSearchItem, VideoSearchResponse, SearchUserParams, SearchUserItem, SearchUserResponse, AvatarThumb, SearchLiveParams, SearchLiveItem, SearchLiveResponse, LiveAuthor, LiveCover, LiveRawData, LiveInfo, SearchExperienceParams, SearchExperienceItem, SearchExperienceResponse, ExperienceCover, SearchMusicParams, SearchMusicItem, SearchMusicResponse, GeneralSearchParams, GeneralSearchItem, GeneralSearchResponse, VisionSearchParams, VisionSearchItem, VisionSearchResponse, PoiSearchParams, PoiItem, PoiSearchResponse } from './search';
|
|
9
|
+
export { searchComment } from './comment';
|
|
10
|
+
export type { CommentSearchParams, CommentSearchItem, CommentSearchResponse } from './comment';
|
|
11
|
+
export { queryTopic, getFollowingList, queryUserBasicData } from './platform';
|
|
12
|
+
export type { TopicQueryParams, TopicQueryResponse, FollowingListParams, FollowingListResponse, UserBasicDataParams, UserBasicDataResponse, UserInfo } from './platform';
|
|
13
|
+
export { getHotList } from './hot';
|
|
14
|
+
export type { HotListParams, HotBoardItem, HotListResponse } from './hot';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHotList = exports.queryUserBasicData = exports.getFollowingList = exports.queryTopic = exports.searchComment = exports.searchPoi = exports.searchVision = exports.searchGeneral = exports.searchMusic = exports.searchExperience = exports.searchLive = exports.searchUser = exports.searchVideo = exports.getFeed = exports.getFollowFeed = exports.getFollowHotWord = exports.getRecommend = exports.getHighQualityText = exports.getAIUserItemList = exports.getAIUserDataInfo = exports.getAIUserProfile = exports.getAffiliateId = exports.getRelatedId = exports.getUserConstellation = exports.callOpenAPI = void 0;
|
|
4
|
+
var core_1 = require("./core");
|
|
5
|
+
Object.defineProperty(exports, "callOpenAPI", { enumerable: true, get: function () { return core_1.callOpenAPI; } });
|
|
6
|
+
var account_1 = require("./account");
|
|
7
|
+
Object.defineProperty(exports, "getUserConstellation", { enumerable: true, get: function () { return account_1.getUserConstellation; } });
|
|
8
|
+
Object.defineProperty(exports, "getRelatedId", { enumerable: true, get: function () { return account_1.getRelatedId; } });
|
|
9
|
+
Object.defineProperty(exports, "getAffiliateId", { enumerable: true, get: function () { return account_1.getAffiliateId; } });
|
|
10
|
+
Object.defineProperty(exports, "getAIUserProfile", { enumerable: true, get: function () { return account_1.getAIUserProfile; } });
|
|
11
|
+
Object.defineProperty(exports, "getAIUserDataInfo", { enumerable: true, get: function () { return account_1.getAIUserDataInfo; } });
|
|
12
|
+
Object.defineProperty(exports, "getAIUserItemList", { enumerable: true, get: function () { return account_1.getAIUserItemList; } });
|
|
13
|
+
var content_1 = require("./content");
|
|
14
|
+
Object.defineProperty(exports, "getHighQualityText", { enumerable: true, get: function () { return content_1.getHighQualityText; } });
|
|
15
|
+
Object.defineProperty(exports, "getRecommend", { enumerable: true, get: function () { return content_1.getRecommend; } });
|
|
16
|
+
Object.defineProperty(exports, "getFollowHotWord", { enumerable: true, get: function () { return content_1.getFollowHotWord; } });
|
|
17
|
+
Object.defineProperty(exports, "getFollowFeed", { enumerable: true, get: function () { return content_1.getFollowFeed; } });
|
|
18
|
+
Object.defineProperty(exports, "getFeed", { enumerable: true, get: function () { return content_1.getFeed; } });
|
|
19
|
+
var search_1 = require("./search");
|
|
20
|
+
Object.defineProperty(exports, "searchVideo", { enumerable: true, get: function () { return search_1.searchVideo; } });
|
|
21
|
+
Object.defineProperty(exports, "searchUser", { enumerable: true, get: function () { return search_1.searchUser; } });
|
|
22
|
+
Object.defineProperty(exports, "searchLive", { enumerable: true, get: function () { return search_1.searchLive; } });
|
|
23
|
+
Object.defineProperty(exports, "searchExperience", { enumerable: true, get: function () { return search_1.searchExperience; } });
|
|
24
|
+
Object.defineProperty(exports, "searchMusic", { enumerable: true, get: function () { return search_1.searchMusic; } });
|
|
25
|
+
Object.defineProperty(exports, "searchGeneral", { enumerable: true, get: function () { return search_1.searchGeneral; } });
|
|
26
|
+
Object.defineProperty(exports, "searchVision", { enumerable: true, get: function () { return search_1.searchVision; } });
|
|
27
|
+
Object.defineProperty(exports, "searchPoi", { enumerable: true, get: function () { return search_1.searchPoi; } });
|
|
28
|
+
var comment_1 = require("./comment");
|
|
29
|
+
Object.defineProperty(exports, "searchComment", { enumerable: true, get: function () { return comment_1.searchComment; } });
|
|
30
|
+
var platform_1 = require("./platform");
|
|
31
|
+
Object.defineProperty(exports, "queryTopic", { enumerable: true, get: function () { return platform_1.queryTopic; } });
|
|
32
|
+
Object.defineProperty(exports, "getFollowingList", { enumerable: true, get: function () { return platform_1.getFollowingList; } });
|
|
33
|
+
Object.defineProperty(exports, "queryUserBasicData", { enumerable: true, get: function () { return platform_1.queryUserBasicData; } });
|
|
34
|
+
var hot_1 = require("./hot");
|
|
35
|
+
Object.defineProperty(exports, "getHotList", { enumerable: true, get: function () { return hot_1.getHotList; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface FollowingListParams {
|
|
3
|
+
user_id: string;
|
|
4
|
+
cursor?: number;
|
|
5
|
+
count?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FollowingListResponse {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 查询用户关注列表
|
|
12
|
+
* 需要 PPE 环境:options 中设置 ppeEnv
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFollowingList(params: FollowingListParams, options?: CallOptions): Promise<OpenAPIResponse<FollowingListResponse>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFollowingList = getFollowingList;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 查询用户关注列表
|
|
7
|
+
* 需要 PPE 环境:options 中设置 ppeEnv
|
|
8
|
+
*/
|
|
9
|
+
async function getFollowingList(params, options) {
|
|
10
|
+
return (0, core_1.callOpenAPI)({
|
|
11
|
+
path: '/dy_open_api/ai_platform/data/get_following_list/',
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: params,
|
|
14
|
+
domain: 'open.douyin.com',
|
|
15
|
+
}, options);
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { queryTopic } from './topic';
|
|
2
|
+
export type { TopicQueryParams, TopicQueryResponse } from './topic';
|
|
3
|
+
export { getFollowingList } from './following';
|
|
4
|
+
export type { FollowingListParams, FollowingListResponse } from './following';
|
|
5
|
+
export { queryUserBasicData } from './user-basic';
|
|
6
|
+
export type { UserBasicDataParams, UserBasicDataResponse, UserInfo } from './user-basic';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryUserBasicData = exports.getFollowingList = exports.queryTopic = void 0;
|
|
4
|
+
var topic_1 = require("./topic");
|
|
5
|
+
Object.defineProperty(exports, "queryTopic", { enumerable: true, get: function () { return topic_1.queryTopic; } });
|
|
6
|
+
var following_1 = require("./following");
|
|
7
|
+
Object.defineProperty(exports, "getFollowingList", { enumerable: true, get: function () { return following_1.getFollowingList; } });
|
|
8
|
+
var user_basic_1 = require("./user-basic");
|
|
9
|
+
Object.defineProperty(exports, "queryUserBasicData", { enumerable: true, get: function () { return user_basic_1.queryUserBasicData; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface TopicQueryParams {
|
|
3
|
+
query: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TopicQueryResponse {
|
|
6
|
+
list: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 查询 AI 平台话题列表
|
|
10
|
+
* 需要 PPE 环境:options 中设置 ppeEnv,或环境变量 APP_ENV=ppe_0629
|
|
11
|
+
*/
|
|
12
|
+
export declare function queryTopic(params: TopicQueryParams, options?: CallOptions): Promise<OpenAPIResponse<TopicQueryResponse>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryTopic = queryTopic;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 查询 AI 平台话题列表
|
|
7
|
+
* 需要 PPE 环境:options 中设置 ppeEnv,或环境变量 APP_ENV=ppe_0629
|
|
8
|
+
*/
|
|
9
|
+
async function queryTopic(params, options) {
|
|
10
|
+
return (0, core_1.callOpenAPI)({
|
|
11
|
+
path: '/dy_open_api/ai_platform/data/query_topic/',
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: params,
|
|
14
|
+
domain: 'open.douyin.com',
|
|
15
|
+
}, options);
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface UserBasicDataParams {
|
|
3
|
+
uid: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UserInfo {
|
|
6
|
+
user_id: string;
|
|
7
|
+
birthday: string;
|
|
8
|
+
register_age: string;
|
|
9
|
+
register_gender: string;
|
|
10
|
+
is_hide_location: number;
|
|
11
|
+
user_create_days: number;
|
|
12
|
+
}
|
|
13
|
+
export interface UserBasicDataResponse {
|
|
14
|
+
user_info: UserInfo;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 查询用户基础数据
|
|
18
|
+
* 需要 PPE 环境:options 中设置 ppeEnv
|
|
19
|
+
*/
|
|
20
|
+
export declare function queryUserBasicData(params: UserBasicDataParams, options?: CallOptions): Promise<OpenAPIResponse<UserBasicDataResponse>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryUserBasicData = queryUserBasicData;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 查询用户基础数据
|
|
7
|
+
* 需要 PPE 环境:options 中设置 ppeEnv
|
|
8
|
+
*/
|
|
9
|
+
async function queryUserBasicData(params, options) {
|
|
10
|
+
return (0, core_1.callOpenAPI)({
|
|
11
|
+
path: '/dy_open_api/ai_platform/data/query_user_basic_data/',
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: params,
|
|
14
|
+
domain: 'open.douyin.com',
|
|
15
|
+
}, options);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface SearchExperienceParams {
|
|
3
|
+
keyword: string;
|
|
4
|
+
device_id?: number;
|
|
5
|
+
uid?: string;
|
|
6
|
+
cursor?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
search_id?: string;
|
|
9
|
+
sort_type?: number;
|
|
10
|
+
content_type?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 图文封面信息。
|
|
14
|
+
*/
|
|
15
|
+
export interface ExperienceCover {
|
|
16
|
+
url_list: string[];
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 图文搜索结果项。
|
|
22
|
+
*/
|
|
23
|
+
export interface SearchExperienceItem {
|
|
24
|
+
item_id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
cover: ExperienceCover;
|
|
27
|
+
content_type: number;
|
|
28
|
+
duration: number;
|
|
29
|
+
nickname: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 图文搜索响应数据。
|
|
33
|
+
*/
|
|
34
|
+
export interface SearchExperienceResponse {
|
|
35
|
+
cursor: number;
|
|
36
|
+
has_more: boolean;
|
|
37
|
+
search_id: string;
|
|
38
|
+
data: SearchExperienceItem[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 抖音图文搜索。
|
|
42
|
+
* @param params - 搜索参数
|
|
43
|
+
*/
|
|
44
|
+
export declare function searchExperience(params: SearchExperienceParams, options?: CallOptions): Promise<OpenAPIResponse<SearchExperienceResponse>>;
|
|
45
|
+
/**
|
|
46
|
+
* 音乐搜索参数。
|
|
47
|
+
*/
|
|
48
|
+
export interface SearchMusicParams {
|
|
49
|
+
keyword: string;
|
|
50
|
+
cursor?: string;
|
|
51
|
+
count?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 音乐搜索结果项。
|
|
55
|
+
*/
|
|
56
|
+
export interface SearchMusicItem {
|
|
57
|
+
mid: string;
|
|
58
|
+
cover: string[];
|
|
59
|
+
author: string;
|
|
60
|
+
duration: number;
|
|
61
|
+
play_addr: string;
|
|
62
|
+
title: string;
|
|
63
|
+
tag: string;
|
|
64
|
+
doyin_share_url: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 音乐搜索响应数据。
|
|
68
|
+
*/
|
|
69
|
+
export interface SearchMusicResponse {
|
|
70
|
+
cursor: number;
|
|
71
|
+
has_more: boolean;
|
|
72
|
+
result: SearchMusicItem[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 抖音音乐搜索。
|
|
76
|
+
* @param params - 搜索参数
|
|
77
|
+
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchExperience = searchExperience;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 抖音图文搜索。
|
|
7
|
+
* @param params - 搜索参数
|
|
8
|
+
*/
|
|
9
|
+
async function searchExperience(params, options) {
|
|
10
|
+
// 处理默认值
|
|
11
|
+
const { device_id, ...restParams } = params;
|
|
12
|
+
const finalParams = {
|
|
13
|
+
...restParams,
|
|
14
|
+
count: params.count && params.count > 0 ? params.count : 5,
|
|
15
|
+
content_type: params.content_type || 2,
|
|
16
|
+
};
|
|
17
|
+
// device_id 有值时才传递
|
|
18
|
+
if (device_id !== undefined && device_id > 0) {
|
|
19
|
+
finalParams.device_id = device_id;
|
|
20
|
+
}
|
|
21
|
+
return (0, core_1.callOpenAPI)({
|
|
22
|
+
path: '/dy_open_api/v1/search/experience/',
|
|
23
|
+
method: 'GET',
|
|
24
|
+
queryParams: finalParams,
|
|
25
|
+
domain: 'open.douyin.com',
|
|
26
|
+
}, options);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 抖音音乐搜索。
|
|
30
|
+
* @param params - 搜索参数
|
|
31
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CallOptions, OpenAPIResponse } from '../core';
|
|
2
|
+
export interface GeneralSearchParams {
|
|
3
|
+
keyword: string;
|
|
4
|
+
cursor?: number;
|
|
5
|
+
count?: number;
|
|
6
|
+
search_id?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GeneralSearchItem {
|
|
9
|
+
item_id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
cover: string;
|
|
12
|
+
item_type: number;
|
|
13
|
+
author_name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GeneralSearchResponse {
|
|
16
|
+
cursor: number;
|
|
17
|
+
has_more: boolean;
|
|
18
|
+
data: GeneralSearchItem[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 抖音综合搜索
|
|
22
|
+
*/
|
|
23
|
+
export declare function searchGeneral(params: GeneralSearchParams, options?: CallOptions): Promise<OpenAPIResponse<GeneralSearchResponse>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchGeneral = searchGeneral;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
/**
|
|
6
|
+
* 抖音综合搜索
|
|
7
|
+
*/
|
|
8
|
+
async function searchGeneral(params, options) {
|
|
9
|
+
return (0, core_1.callOpenAPI)({
|
|
10
|
+
path: '/dy_open_api/v1/search/dy/',
|
|
11
|
+
method: 'GET',
|
|
12
|
+
queryParams: params,
|
|
13
|
+
domain: 'open.douyin.com',
|
|
14
|
+
}, options);
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { searchVideo } from './search';
|
|
2
|
+
export type { VideoSearchParams, VideoSearchItem, VideoSearchResponse } from './search';
|
|
3
|
+
export { searchUser } from './search';
|
|
4
|
+
export type { SearchUserParams, SearchUserItem, SearchUserResponse, AvatarThumb } from './search';
|
|
5
|
+
export { searchLive } from './search';
|
|
6
|
+
export type { SearchLiveParams, SearchLiveItem, SearchLiveResponse, LiveAuthor, LiveCover, LiveRawData, LiveInfo } from './search';
|
|
7
|
+
export { searchExperience } from './experience';
|
|
8
|
+
export type { SearchExperienceParams, SearchExperienceItem, SearchExperienceResponse, ExperienceCover } from './experience';
|
|
9
|
+
export { searchMusic } from './music';
|
|
10
|
+
export type { SearchMusicParams, SearchMusicItem, SearchMusicResponse } from './music';
|
|
11
|
+
export { searchGeneral } from './general';
|
|
12
|
+
export type { GeneralSearchParams, GeneralSearchItem, GeneralSearchResponse } from './general';
|
|
13
|
+
export { searchVision } from './vision';
|
|
14
|
+
export type { VisionSearchParams, VisionSearchItem, VisionSearchResponse } from './vision';
|
|
15
|
+
export { searchPoi } from './poi';
|
|
16
|
+
export type { PoiSearchParams, PoiItem, PoiSearchResponse } from './poi';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchPoi = exports.searchVision = exports.searchGeneral = exports.searchMusic = exports.searchExperience = exports.searchLive = exports.searchUser = exports.searchVideo = void 0;
|
|
4
|
+
// 搜索相关 OpenAPI
|
|
5
|
+
// 视频搜索
|
|
6
|
+
var search_1 = require("./search");
|
|
7
|
+
Object.defineProperty(exports, "searchVideo", { enumerable: true, get: function () { return search_1.searchVideo; } });
|
|
8
|
+
// 用户搜索
|
|
9
|
+
var search_2 = require("./search");
|
|
10
|
+
Object.defineProperty(exports, "searchUser", { enumerable: true, get: function () { return search_2.searchUser; } });
|
|
11
|
+
// 直播搜索
|
|
12
|
+
var search_3 = require("./search");
|
|
13
|
+
Object.defineProperty(exports, "searchLive", { enumerable: true, get: function () { return search_3.searchLive; } });
|
|
14
|
+
// 图文搜索
|
|
15
|
+
var experience_1 = require("./experience");
|
|
16
|
+
Object.defineProperty(exports, "searchExperience", { enumerable: true, get: function () { return experience_1.searchExperience; } });
|
|
17
|
+
// 音乐搜索
|
|
18
|
+
var music_1 = require("./music");
|
|
19
|
+
Object.defineProperty(exports, "searchMusic", { enumerable: true, get: function () { return music_1.searchMusic; } });
|
|
20
|
+
// 综合搜索
|
|
21
|
+
var general_1 = require("./general");
|
|
22
|
+
Object.defineProperty(exports, "searchGeneral", { enumerable: true, get: function () { return general_1.searchGeneral; } });
|
|
23
|
+
// 视觉图搜
|
|
24
|
+
var vision_1 = require("./vision");
|
|
25
|
+
Object.defineProperty(exports, "searchVision", { enumerable: true, get: function () { return vision_1.searchVision; } });
|
|
26
|
+
// 团购搜索
|
|
27
|
+
var poi_1 = require("./poi");
|
|
28
|
+
Object.defineProperty(exports, "searchPoi", { enumerable: true, get: function () { return poi_1.searchPoi; } });
|