Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 抖音补评论二级列表
yikaJasonMic951462593f11
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex c3982825..f4c10b69 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -1,7 +1,7 @@/** @Author: nevin* @Date: 2025-02-08 11:40:45- * @LastEditTime: 2025-03-21 22:57:29+ * @LastEditTime: 2025-03-22 17:55:12* @LastEditors: nevin* @Description: 抖音*/@@ -192,8 +192,36 @@ export class Douyin extends PlatformBase {cursor: pcursor || undefined,});- const list: CommentData[] = res.data.comment_info_list.map((v: any) => {- return {+ const list: CommentData[] = [];++ for (const v of res.data.comment_info_list) {+ const subList: CommentData[] = [];+ if (v.level === 1 && Number.parseInt(v.reply_count) > 0) {+ const res2 = await douyinService.getCreatorCommentReplyList(+ cookie,+ v.comment_id,+ dataId,+ {+ cursor: 0 + '',+ count: 20,+ },+ );+ if (res2.status === 200 && res2.data.status_code === 0) {+ for (const element of res2.data.comments) {+ subList.push({+ dataId: dataId,+ commentId: element.cid,+ content: element.text,+ nikeName: element.user.nickname,+ headUrl: element.user.avatar_thumb.url_list[0] || '',+ data: element,+ subCommentList: [],+ });+ }+ }+ }++ list.push({dataId: dataId,commentId: v.comment_id,content: v.text,@@ -201,9 +229,9 @@ export class Douyin extends PlatformBase {nikeName: v.user_info.screen_name,headUrl: v.user_info.avatar_url,data: v,- subCommentList: [],- };- });+ subCommentList: subList,+ });+ }return {list,diff --git a/electron/plat/douyin/douyin.type.ts b/electron/plat/douyin/douyin.type.tsindex 2fd98395..100789f6 100644--- a/electron/plat/douyin/douyin.type.ts+++ b/electron/plat/douyin/douyin.type.ts@@ -454,6 +454,270 @@ export interface DouyinCreatorCommentListResponse {total_count: number; // 3;}+// 抖音评论回复列表+export interface DouyinCommentReplyListResponse {+ status_code: 0;+ comments: {+ cid: string; // '7484226055910605622';+ text: string; // ''哈哈哈,[捂脸],留不长,发质太差了';+ aweme_id: string; // ''7484154434176568630';+ create_time: number; // 1742557174;+ digg_count: number; // 0;+ status: number; // 1;+ user: {+ uid: string; // ''153519948306846';+ short_id: string; // ''2308542007';+ nickname: string; // ''海宝💃';+ signature: string; // ''';+ avatar_larger: {+ uri: string; // ''';+ url_list: string[]; // [];+ width: number; // 720;+ height: number; // 720;+ };+ avatar_thumb: {+ uri: string; // ''100x100/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';+ url_list: string[]; // 'https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1.jpeg?from=2956013662',+ width: number; // 720;+ height: number; // 720;+ };+ avatar_medium: {+ uri: string; // '720x720/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';+ url_list: string[]; // 'https://p3.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1.jpeg?from=2956013662',+ width: number; // 720;+ height: number; // 720;+ };+ is_verified: boolean; // true;+ follow_status: number; // 0;+ aweme_count: number; // 0;+ following_count: number; // 0;+ follower_count: number; // 0;+ favoriting_count: number; // 0;+ total_favorited: number; // 0;+ is_block: boolean; // false;+ hide_search: boolean; // true;+ constellation: number; // 9;+ location: string; // '';+ hide_location: boolean; // false;+ weibo_verify: string; // '';+ custom_verify: string; // '';+ unique_id: string; // 'dyehawbhyehm';+ bind_phone: string; // '';+ special_lock: number; // 1;+ need_recommend: number; // 1;+ is_binded_weibo: boolean; // false;+ weibo_name: string; // '';+ weibo_schema: string; // '';+ weibo_url: string; // '';+ story_open: boolean; // false;+ story_count: number; // 0;+ has_facebook_token: boolean; // false;+ has_twitter_token: boolean; // false;+ fb_expire_time: number; // 0;+ tw_expire_time: number; // 0;+ has_youtube_token: boolean; // false;+ youtube_expire_time: number; // 0;+ room_id: number; // 0;+ live_verify: number; // 2;+ authority_status: number; // 0;+ verify_info: string; // '';+ shield_follow_notice: number; // 0;+ shield_digg_notice: number; // 0;+ shield_comment_notice: number; // 0;+ school_name: string; // '';+ school_poi_id: string; // '';+ school_type: number; // 0;+ with_commerce_entry: boolean; // false;+ verification_type: number; // 1;+ enterprise_verify_reason: string; // '';+ is_ad_fake: boolean; // false;+ followers_detail: null;+ region: string; // 'CN';+ account_region: string; // '';+ sync_to_toutiao: number; // 0;+ live_agreement: number; // 0;+ platform_sync_info: null;+ with_shop_entry: boolean; // false;+ secret: number; // 0;+ has_orders: boolean; // true;+ prevent_download: boolean; // false;+ show_image_bubble: boolean; // false;+ geofencing: any[]; // [];+ unique_id_modify_time: number; // 1742631181;+ video_icon: {+ uri: string; // '';+ url_list: string[];+ width: number; // 720;+ height: number; // 720;+ };+ ins_id: string; // '';+ google_account: string; // '';+ youtube_channel_id: string; // '';+ youtube_channel_title: string; // '';+ apple_account: number; // 0;+ with_dou_entry: boolean; // false;+ with_fusion_shop_entry: boolean; // false;+ is_phone_binded: boolean; // false;+ accept_private_policy: boolean; // false;+ twitter_id: string; // '';+ twitter_name: string; // '';+ user_canceled: boolean; // false;+ has_email: boolean; // false;+ is_gov_media_vip: boolean; // false;+ live_agreement_time: number; // 0;+ status: number; // 1;+ avatar_uri: string; // 'aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';+ follower_status: number; // 0;+ neiguang_shield: number; // 0;+ comment_setting: number; // 0;+ duet_setting: number; // 0;+ reflow_page_gid: number; // 0;+ reflow_page_uid: number; // 0;+ user_rate: number; // 1;+ download_setting: number; // -1;+ download_prompt_ts: number; // 0;+ react_setting: number; // 0;+ live_commerce: boolean; // false;+ cover_url: string[]; // [];+ show_gender_strategy: number; // 0;+ language: string; // 'zh-Hans';+ has_insights: boolean; // false;+ item_list: null;+ user_mode: number; // 0;+ user_period: number; // 0;+ has_unread_story: boolean; // false;+ new_story_cover: null;+ is_star: boolean; // false;+ cv_level: string; // '';+ type_label: any; // null;+ ad_cover_url: any; // null;+ comment_filter_status: number; // 0;+ avatar_168x168: {+ uri: string; // '';+ url_list: string[]; // [];+ width: number; // 720;+ height: number; // 720;+ };+ avatar_300x300: {+ uri: string; // '';+ url_list: string[]; //[];+ width: number; // 720;+ height: number; // 720;+ };+ relative_users: any; // null;+ cha_list: any; // null;+ sec_uid: string; // 'MS4wLjABAAAAh24q23iMa0OxvuFitRcT13v6lQJpYWVp7TEZGcuX908';+ urge_detail: {+ user_urged: number; // 0;+ };+ need_points: any; // null;+ homepage_bottom_toast: any; // null;+ can_set_geofencing: any; // null;+ room_id_str: string; // '0';+ white_cover_url: any; // null;+ user_tags: any; // null;+ stitch_setting: number; // 0;+ is_mix_user: boolean; // false;+ enable_nearby_visible: boolean; // true;+ ban_user_functions: any[]; // [];+ aweme_control: {+ can_forward: boolean; // true;+ can_share: boolean; // true;+ can_comment: boolean; // true;+ can_show_comment: boolean; // true;+ };+ user_not_show: number; // 1;+ ky_only_predict: number; // 0;+ user_not_see: number; // 0;+ card_entries: any; // null;+ signature_display_lines: number; // 5;+ display_info: any; // null;+ follower_request_status: number; // 0;+ live_status: number; // 0;+ is_not_show: boolean; // false;+ card_entries_not_display: any; // null;+ card_sort_priority: any; // null;+ show_nearby_active: boolean; // false;+ interest_tags: any; // null;+ school_category: number; // 0;+ search_impr: {+ entity_id: string; // '153519948306846';+ };+ link_item_list: any; // null;+ user_permissions: any; // null;+ offline_info_list: any; // null;+ is_cf: number; // 0;+ is_blocking_v2: boolean; // false;+ is_blocked_v2: boolean; // false;+ close_friend_type: number; // 0;+ signature_extra: any; // null;+ max_follower_count: number; // 0;+ personal_tag_list: any; // null;+ cf_list: any; // null;+ im_role_ids: any; // null;+ not_seen_item_id_list: any; // null;+ user_age: number; // 32;+ contacts_status: number; // 1;+ risk_notice_text: string; // '';+ follower_list_secondary_information_struct: any; // null;+ endorsement_info_list: any; // null;+ text_extra: any; // null;+ contrail_list: any; // null;+ data_label_list: any; // null;+ not_seen_item_id_list_v2: any; // null;+ is_ban: boolean; // false;+ special_people_labels: any; // null;+ special_follow_status: number; // 0;+ familiar_visitor_user: any; // null;+ live_high_value: number; // 0;+ avatar_schema_list: any; // null;+ profile_mob_params: any; // null;+ disable_image_comment_saved: number; // 0;+ verification_permission_ids: any; // null;+ batch_unfollow_relation_desc: any; // null;+ batch_unfollow_contain_tabs: any; // null;+ creator_tag_list: any; // null;+ private_relation_list: any; // null;+ mate_add_permission: number; // 0;+ familiar_confidence: number; // 0;+ mate_count: number; // 0;+ follower_count_str: string; // '';+ social_real_relation_type: number; // 0;+ };+ reply_id: string; // '7484209708376032050';+ user_digged: number; // 0;+ reply_comment: any; // null;+ text_extra: string[];+ label_text: string; // '作者';+ label_type: number; // 1;+ reply_to_reply_id: string; // '0';+ is_author_digged: boolean; // false;+ user_buried: boolean; // false;+ label_list: any; // null;+ is_hot: boolean; // false;+ text_music_info: any; // null;+ image_list: any; // null;+ is_note_comment: number; // 0;+ root_comment_id: string; // '7484226055910605622';+ can_share: boolean; // true;+ level: number; // 2;+ comment_reply_total: number; // 1;+ video_list: any; // null;+ content_type: number; // 1;+ is_folded: boolean; // false;+ }[];+ cursor: number; // 10;+ has_more: number; // 0;+ total: number; // 1;+ extra: {+ now: number; // 1742631181000;+ fatal_item_ids: any; // null;+ };+ log_pb: {+ impr_id: string; // '20250322161300615408A9FEC29A97BD28';+ };+}+export interface DouyinNewCommentResponse {comment_info: {comment_id: string; // '@j/Jr6bdET0rxssxd57/to896qi+WZSz3LqQlN6Nuja9BugWjRo0mWYw1IBd39et4ggwDVwRptqsgeUQSJiFcAg==';diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.tsindex 2d555fd1..3e7f7132 100644--- a/electron/plat/douyin/index.ts+++ b/electron/plat/douyin/index.ts@@ -12,6 +12,7 @@ import {DouyinActivityListResponse,DouyinActivityTagsResponse,DouyinAllHotDataResponse,+ DouyinCommentReplyListResponse,DouyinCreatorCommentListResponse,DouyinCreatorListResponse,DouyinHotDataResponse,@@ -2263,7 +2264,7 @@ export class DouyinService {/*** 查询抖音的作品列表* @param cookie- * @param msToken+ * @param cursor* @returns*/async getCreatorItems(cookie: Electron.Cookie[], cursor?: string) {@@ -2310,6 +2311,38 @@ export class DouyinService {return res;}+ // 查看评论的回复列表+ async getCreatorCommentReplyList(+ cookie: Electron.Cookie[],+ comment_id: string, // 评论ID+ item_id: string, // 作品ID+ pageInfo: {+ cursor?: string;+ count?: number;+ },+ ) {+ const res = await requestNet<DouyinCommentReplyListResponse>({+ url: CommonUtils.buildUrl(+ `https://creator.douyin.com/web/api/third_party/aweme/api/comment/read/aweme/v1/web/comment/list/reply/`, // msToken=xxx+ {+ cursor: pageInfo.cursor,+ count: pageInfo.count,+ comment_id: comment_id,+ item_id: item_id,+ app_id: 2906,+ aid: 2906,+ device_platform: 'webapp',+ },+ ),+ headers: {+ cookie: CookieToString(cookie),+ },+ method: 'GET',+ });++ return res;+ }+// 作品的评论回复async creatorCommentReply(cookie: Electron.Cookie[],