@iflyrpa/actions 2.0.0-beta.1 → 2.0.0-beta.2

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/dist/bundle.js CHANGED
@@ -4937,6 +4937,640 @@ var __webpack_modules__ = {
4937
4937
  }
4938
4938
  module.exports = GenXSCommon;
4939
4939
  },
4940
+ "./src/utils/douyin/csrfToken.js": function(module, __unused_webpack_exports, __webpack_require__) {
4941
+ const crypto = __webpack_require__("crypto");
4942
+ function generateCsrfToken(options = {}) {
4943
+ const { cookies = [], url = '', method = 'POST' } = options;
4944
+ const sessionid = getCookieValue(cookies, 'sessionid') || '';
4945
+ const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
4946
+ const msToken = getCookieValue(cookies, 'msToken') || '';
4947
+ const ttwid = getCookieValue(cookies, 'ttwid') || '';
4948
+ const timestamp = Math.floor(Date.now() / 1000);
4949
+ const version = '0000';
4950
+ const timestampHex = timestamp.toString(16).padStart(8, '0');
4951
+ const random = generateRandomHex(8);
4952
+ const signData = `${method}${url}${sessionid}${uid_tt}${msToken}${ttwid}${timestamp}`;
4953
+ const hash = crypto.createHash('md5').update(signData).digest('hex');
4954
+ const csrfToken = `0001${version}${timestampHex}${random}${hash}`;
4955
+ return csrfToken;
4956
+ }
4957
+ function getCookieValue(cookies, name) {
4958
+ const cookie = cookies.find((c)=>c.name === name);
4959
+ return cookie ? cookie.value : '';
4960
+ }
4961
+ function generateRandomHex(length) {
4962
+ const bytes = crypto.randomBytes(Math.ceil(length / 2));
4963
+ return bytes.toString('hex').slice(0, length);
4964
+ }
4965
+ function generateCsrfTokenAdvanced(options = {}) {
4966
+ const { cookies = [], url = '', method = 'POST', userAgent = '' } = options;
4967
+ const sessionid = getCookieValue(cookies, 'sessionid') || '';
4968
+ const sid_guard = getCookieValue(cookies, 'sid_guard') || '';
4969
+ const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
4970
+ const msToken = getCookieValue(cookies, 'msToken') || '';
4971
+ const ttwid = getCookieValue(cookies, 'ttwid') || '';
4972
+ const odin_tt = getCookieValue(cookies, 'odin_tt') || '';
4973
+ const timestamp = Date.now();
4974
+ const timestampSec = Math.floor(timestamp / 1000);
4975
+ let pathname = '';
4976
+ try {
4977
+ const urlObj = new URL(url, 'https://creator.douyin.com');
4978
+ pathname = urlObj.pathname;
4979
+ } catch (e) {
4980
+ pathname = url;
4981
+ }
4982
+ const signParts = [
4983
+ method.toUpperCase(),
4984
+ pathname,
4985
+ timestampSec,
4986
+ sessionid,
4987
+ sid_guard,
4988
+ uid_tt,
4989
+ msToken,
4990
+ ttwid,
4991
+ odin_tt,
4992
+ userAgent
4993
+ ].filter(Boolean);
4994
+ const signData = signParts.join('|');
4995
+ const firstHash = crypto.createHash('md5').update(signData).digest('hex');
4996
+ const secondHash = crypto.createHash('md5').update(firstHash + timestamp).digest('hex');
4997
+ const timestampHex = timestampSec.toString(16).padStart(8, '0');
4998
+ const random = generateRandomHex(16);
4999
+ return `0001000${timestampHex.slice(0, 2)}${random}${secondHash}`;
5000
+ }
5001
+ function generateCsrfTokenSimple(cookies = []) {
5002
+ const sessionid = getCookieValue(cookies, 'sessionid') || 'default_session';
5003
+ const timestamp = Math.floor(Date.now() / 1000);
5004
+ const random = generateRandomHex(32);
5005
+ const hash = crypto.createHash('md5').update(`${sessionid}${timestamp}${random}`).digest('hex');
5006
+ const timestampHex = timestamp.toString(16).padStart(8, '0');
5007
+ return `0001000${timestampHex}${random}${hash}`.slice(0, 90);
5008
+ }
5009
+ function parseCsrfToken(token) {
5010
+ if (!token || token.length < 20) return null;
5011
+ try {
5012
+ const prefix = token.slice(0, 4);
5013
+ const version = token.slice(4, 8);
5014
+ const timestampHex = token.slice(8, 16);
5015
+ const timestamp = parseInt(timestampHex, 16);
5016
+ const date = new Date(1000 * timestamp);
5017
+ return {
5018
+ prefix,
5019
+ version,
5020
+ timestamp,
5021
+ date: date.toISOString(),
5022
+ isValid: '0001' === prefix
5023
+ };
5024
+ } catch (e) {
5025
+ return null;
5026
+ }
5027
+ }
5028
+ module.exports = {
5029
+ generateCsrfToken,
5030
+ generateCsrfTokenAdvanced,
5031
+ generateCsrfTokenSimple,
5032
+ parseCsrfToken
5033
+ };
5034
+ },
5035
+ "./src/utils/douyin/douyin.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5036
+ "use strict";
5037
+ __webpack_require__.r(__webpack_exports__);
5038
+ __webpack_require__.d(__webpack_exports__, {
5039
+ sign_datail: ()=>sign_datail,
5040
+ sign_reply: ()=>sign_reply
5041
+ });
5042
+ function rc4_encrypt(plaintext, key) {
5043
+ var s = [];
5044
+ for(var i = 0; i < 256; i++)s[i] = i;
5045
+ var j = 0;
5046
+ for(var i = 0; i < 256; i++){
5047
+ j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
5048
+ var temp = s[i];
5049
+ s[i] = s[j];
5050
+ s[j] = temp;
5051
+ }
5052
+ var i = 0;
5053
+ var j = 0;
5054
+ var cipher = [];
5055
+ for(var k = 0; k < plaintext.length; k++){
5056
+ i = (i + 1) % 256;
5057
+ j = (j + s[i]) % 256;
5058
+ var temp = s[i];
5059
+ s[i] = s[j];
5060
+ s[j] = temp;
5061
+ var t = (s[i] + s[j]) % 256;
5062
+ cipher.push(String.fromCharCode(s[t] ^ plaintext.charCodeAt(k)));
5063
+ }
5064
+ return cipher.join('');
5065
+ }
5066
+ function le(e, r) {
5067
+ return (e << (r %= 32) | e >>> 32 - r) >>> 0;
5068
+ }
5069
+ function de(e) {
5070
+ return 0 <= e && e < 16 ? 2043430169 : 16 <= e && e < 64 ? 2055708042 : void console['error']("invalid j for constant Tj");
5071
+ }
5072
+ function pe(e, r, t, n) {
5073
+ return 0 <= e && e < 16 ? (r ^ t ^ n) >>> 0 : 16 <= e && e < 64 ? (r & t | r & n | t & n) >>> 0 : (console['error']('invalid j for bool function FF'), 0);
5074
+ }
5075
+ function he(e, r, t, n) {
5076
+ return 0 <= e && e < 16 ? (r ^ t ^ n) >>> 0 : 16 <= e && e < 64 ? (r & t | ~r & n) >>> 0 : (console['error']('invalid j for bool function GG'), 0);
5077
+ }
5078
+ function reset() {
5079
+ this.reg[0] = 1937774191, this.reg[1] = 1226093241, this.reg[2] = 388252375, this.reg[3] = 3666478592, this.reg[4] = 2842636476, this.reg[5] = 372324522, this.reg[6] = 3817729613, this.reg[7] = 2969243214, this["chunk"] = [], this["size"] = 0;
5080
+ }
5081
+ function write(e) {
5082
+ var a = "string" == typeof e ? function(e) {
5083
+ var n = encodeURIComponent(e)['replace'](/%([0-9A-F]{2})/g, function(e, r) {
5084
+ return String['fromCharCode']("0x" + r);
5085
+ }), a = new Array(n['length']);
5086
+ return Array['prototype']['forEach']['call'](n, function(e, r) {
5087
+ a[r] = e.charCodeAt(0);
5088
+ }), a;
5089
+ }(e) : e;
5090
+ this.size += a.length;
5091
+ var f = 64 - this['chunk']['length'];
5092
+ if (a['length'] < f) this['chunk'] = this['chunk'].concat(a);
5093
+ else for(this['chunk'] = this['chunk'].concat(a.slice(0, f)); this['chunk'].length >= 64;)this['_compress'](this['chunk']), f < a['length'] ? this['chunk'] = a['slice'](f, Math['min'](f + 64, a['length'])) : this['chunk'] = [], f += 64;
5094
+ }
5095
+ function sum(e, t) {
5096
+ e && (this['reset'](), this['write'](e)), this['_fill']();
5097
+ for(var f = 0; f < this.chunk['length']; f += 64)this._compress(this['chunk']['slice'](f, f + 64));
5098
+ var i = null;
5099
+ if ('hex' == t) {
5100
+ i = "";
5101
+ for(f = 0; f < 8; f++)i += se(this['reg'][f]['toString'](16), 8, "0");
5102
+ } else for(i = new Array(32), f = 0; f < 8; f++){
5103
+ var c = this.reg[f];
5104
+ i[4 * f + 3] = (255 & c) >>> 0, c >>>= 8, i[4 * f + 2] = (255 & c) >>> 0, c >>>= 8, i[4 * f + 1] = (255 & c) >>> 0, c >>>= 8, i[4 * f] = (255 & c) >>> 0;
5105
+ }
5106
+ return this['reset'](), i;
5107
+ }
5108
+ function _compress(t) {
5109
+ if (t < 64) console.error("compress error: not enough data");
5110
+ else {
5111
+ for(var f = function(e) {
5112
+ for(var r = new Array(132), t = 0; t < 16; t++)r[t] = e[4 * t] << 24, r[t] |= e[4 * t + 1] << 16, r[t] |= e[4 * t + 2] << 8, r[t] |= e[4 * t + 3], r[t] >>>= 0;
5113
+ for(var n = 16; n < 68; n++){
5114
+ var a = r[n - 16] ^ r[n - 9] ^ le(r[n - 3], 15);
5115
+ a = a ^ le(a, 15) ^ le(a, 23), r[n] = (a ^ le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
5116
+ }
5117
+ for(n = 0; n < 64; n++)r[n + 68] = (r[n] ^ r[n + 4]) >>> 0;
5118
+ return r;
5119
+ }(t), i = this['reg'].slice(0), c = 0; c < 64; c++){
5120
+ var o = le(i[0], 12) + i[4] + le(de(c), c), s = ((o = le(o = (4294967295 & o) >>> 0, 7)) ^ le(i[0], 12)) >>> 0, u = pe(c, i[0], i[1], i[2]);
5121
+ u = (4294967295 & (u = u + i[3] + s + f[c + 68])) >>> 0;
5122
+ var b = he(c, i[4], i[5], i[6]);
5123
+ b = (4294967295 & (b = b + i[7] + o + f[c])) >>> 0, i[3] = i[2], i[2] = le(i[1], 9), i[1] = i[0], i[0] = u, i[7] = i[6], i[6] = le(i[5], 19), i[5] = i[4], i[4] = (b ^ le(b, 9) ^ le(b, 17)) >>> 0;
5124
+ }
5125
+ for(var l = 0; l < 8; l++)this['reg'][l] = (this['reg'][l] ^ i[l]) >>> 0;
5126
+ }
5127
+ }
5128
+ function _fill() {
5129
+ var a = 8 * this['size'], f = this['chunk']['push'](128) % 64;
5130
+ for(64 - f < 8 && (f -= 64); f < 56; f++)this.chunk['push'](0);
5131
+ for(var i = 0; i < 4; i++){
5132
+ var c = Math['floor'](a / 4294967296);
5133
+ this['chunk'].push(c >>> 8 * (3 - i) & 255);
5134
+ }
5135
+ for(i = 0; i < 4; i++)this['chunk']['push'](a >>> 8 * (3 - i) & 255);
5136
+ }
5137
+ function SM3() {
5138
+ this.reg = [];
5139
+ this.chunk = [];
5140
+ this.size = 0;
5141
+ this.reset();
5142
+ }
5143
+ SM3.prototype.reset = reset;
5144
+ SM3.prototype.write = write;
5145
+ SM3.prototype.sum = sum;
5146
+ SM3.prototype._compress = _compress;
5147
+ SM3.prototype._fill = _fill;
5148
+ function result_encrypt(long_str, num = null) {
5149
+ let s_obj = {
5150
+ s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
5151
+ s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
5152
+ s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
5153
+ s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
5154
+ s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
5155
+ };
5156
+ let constant = {
5157
+ 0: 16515072,
5158
+ 1: 258048,
5159
+ 2: 4032,
5160
+ str: s_obj[num]
5161
+ };
5162
+ let result = "";
5163
+ let lound = 0;
5164
+ let long_int = get_long_int(lound, long_str);
5165
+ for(let i = 0; i < long_str.length / 3 * 4; i++){
5166
+ if (Math.floor(i / 4) !== lound) {
5167
+ lound += 1;
5168
+ long_int = get_long_int(lound, long_str);
5169
+ }
5170
+ let key = i % 4;
5171
+ let temp_int = 0;
5172
+ switch(key){
5173
+ case 0:
5174
+ temp_int = (long_int & constant["0"]) >> 18;
5175
+ result += constant["str"].charAt(temp_int);
5176
+ break;
5177
+ case 1:
5178
+ temp_int = (long_int & constant["1"]) >> 12;
5179
+ result += constant["str"].charAt(temp_int);
5180
+ break;
5181
+ case 2:
5182
+ temp_int = (long_int & constant["2"]) >> 6;
5183
+ result += constant["str"].charAt(temp_int);
5184
+ break;
5185
+ case 3:
5186
+ temp_int = 63 & long_int;
5187
+ result += constant["str"].charAt(temp_int);
5188
+ break;
5189
+ default:
5190
+ break;
5191
+ }
5192
+ }
5193
+ return result;
5194
+ }
5195
+ function get_long_int(round, long_str) {
5196
+ round *= 3;
5197
+ return long_str.charCodeAt(round) << 16 | long_str.charCodeAt(round + 1) << 8 | long_str.charCodeAt(round + 2);
5198
+ }
5199
+ function gener_random(random, option) {
5200
+ return [
5201
+ 170 & random | 85 & option[0],
5202
+ 85 & random | 170 & option[0],
5203
+ random >> 8 & 170 | 85 & option[1],
5204
+ random >> 8 & 85 | 170 & option[1]
5205
+ ];
5206
+ }
5207
+ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suffix = "cus", Arguments = [
5208
+ 0,
5209
+ 1,
5210
+ 14
5211
+ ]) {
5212
+ let sm3 = new SM3();
5213
+ let start_time = Date.now();
5214
+ let url_search_params_list = sm3.sum(sm3.sum(url_search_params + suffix));
5215
+ let cus = sm3.sum(sm3.sum(suffix));
5216
+ let ua = sm3.sum(result_encrypt(rc4_encrypt(user_agent, String.fromCharCode.apply(null, [
5217
+ 0.00390625,
5218
+ 1,
5219
+ Arguments[2]
5220
+ ])), "s3"));
5221
+ let end_time = Date.now();
5222
+ let b = {
5223
+ 8: 3,
5224
+ 10: end_time,
5225
+ 15: {
5226
+ aid: 6383,
5227
+ pageId: 6241,
5228
+ boe: false,
5229
+ ddrt: 7,
5230
+ paths: {
5231
+ include: [
5232
+ {},
5233
+ {},
5234
+ {},
5235
+ {},
5236
+ {},
5237
+ {},
5238
+ {}
5239
+ ],
5240
+ exclude: []
5241
+ },
5242
+ track: {
5243
+ mode: 0,
5244
+ delay: 300,
5245
+ paths: []
5246
+ },
5247
+ dump: true,
5248
+ rpU: ""
5249
+ },
5250
+ 16: start_time,
5251
+ 18: 44,
5252
+ 19: [
5253
+ 1,
5254
+ 0,
5255
+ 1,
5256
+ 5
5257
+ ]
5258
+ };
5259
+ b[20] = b[16] >> 24 & 255;
5260
+ b[21] = b[16] >> 16 & 255;
5261
+ b[22] = b[16] >> 8 & 255;
5262
+ b[23] = 255 & b[16];
5263
+ b[24] = b[16] / 256 / 256 / 256 / 256 >> 0;
5264
+ b[25] = b[16] / 256 / 256 / 256 / 256 / 256 >> 0;
5265
+ b[26] = Arguments[0] >> 24 & 255;
5266
+ b[27] = Arguments[0] >> 16 & 255;
5267
+ b[28] = Arguments[0] >> 8 & 255;
5268
+ b[29] = 255 & Arguments[0];
5269
+ b[30] = Arguments[1] / 256 & 255;
5270
+ b[31] = Arguments[1] % 256 & 255;
5271
+ b[32] = Arguments[1] >> 24 & 255;
5272
+ b[33] = Arguments[1] >> 16 & 255;
5273
+ b[34] = Arguments[2] >> 24 & 255;
5274
+ b[35] = Arguments[2] >> 16 & 255;
5275
+ b[36] = Arguments[2] >> 8 & 255;
5276
+ b[37] = 255 & Arguments[2];
5277
+ b[38] = url_search_params_list[21];
5278
+ b[39] = url_search_params_list[22];
5279
+ b[40] = cus[21];
5280
+ b[41] = cus[22];
5281
+ b[42] = ua[23];
5282
+ b[43] = ua[24];
5283
+ b[44] = b[10] >> 24 & 255;
5284
+ b[45] = b[10] >> 16 & 255;
5285
+ b[46] = b[10] >> 8 & 255;
5286
+ b[47] = 255 & b[10];
5287
+ b[48] = b[8];
5288
+ b[49] = b[10] / 256 / 256 / 256 / 256 >> 0;
5289
+ b[50] = b[10] / 256 / 256 / 256 / 256 / 256 >> 0;
5290
+ b[51] = b[15]['pageId'];
5291
+ b[52] = b[15]['pageId'] >> 24 & 255;
5292
+ b[53] = b[15]['pageId'] >> 16 & 255;
5293
+ b[54] = b[15]['pageId'] >> 8 & 255;
5294
+ b[55] = 255 & b[15]['pageId'];
5295
+ b[56] = b[15]['aid'];
5296
+ b[57] = 255 & b[15]['aid'];
5297
+ b[58] = b[15]['aid'] >> 8 & 255;
5298
+ b[59] = b[15]['aid'] >> 16 & 255;
5299
+ b[60] = b[15]['aid'] >> 24 & 255;
5300
+ let window_env_list = [];
5301
+ for(let index = 0; index < window_env_str.length; index++)window_env_list.push(window_env_str.charCodeAt(index));
5302
+ b[64] = window_env_list.length;
5303
+ b[65] = 255 & b[64];
5304
+ b[66] = b[64] >> 8 & 255;
5305
+ b[69] = 0;
5306
+ b[70] = 255 & b[69];
5307
+ b[71] = b[69] >> 8 & 255;
5308
+ b[72] = b[18] ^ b[20] ^ b[26] ^ b[30] ^ b[38] ^ b[40] ^ b[42] ^ b[21] ^ b[27] ^ b[31] ^ b[35] ^ b[39] ^ b[41] ^ b[43] ^ b[22] ^ b[28] ^ b[32] ^ b[36] ^ b[23] ^ b[29] ^ b[33] ^ b[37] ^ b[44] ^ b[45] ^ b[46] ^ b[47] ^ b[48] ^ b[49] ^ b[50] ^ b[24] ^ b[25] ^ b[52] ^ b[53] ^ b[54] ^ b[55] ^ b[57] ^ b[58] ^ b[59] ^ b[60] ^ b[65] ^ b[66] ^ b[70] ^ b[71];
5309
+ let bb = [
5310
+ b[18],
5311
+ b[20],
5312
+ b[52],
5313
+ b[26],
5314
+ b[30],
5315
+ b[34],
5316
+ b[58],
5317
+ b[38],
5318
+ b[40],
5319
+ b[53],
5320
+ b[42],
5321
+ b[21],
5322
+ b[27],
5323
+ b[54],
5324
+ b[55],
5325
+ b[31],
5326
+ b[35],
5327
+ b[57],
5328
+ b[39],
5329
+ b[41],
5330
+ b[43],
5331
+ b[22],
5332
+ b[28],
5333
+ b[32],
5334
+ b[60],
5335
+ b[36],
5336
+ b[23],
5337
+ b[29],
5338
+ b[33],
5339
+ b[37],
5340
+ b[44],
5341
+ b[45],
5342
+ b[59],
5343
+ b[46],
5344
+ b[47],
5345
+ b[48],
5346
+ b[49],
5347
+ b[50],
5348
+ b[24],
5349
+ b[25],
5350
+ b[65],
5351
+ b[66],
5352
+ b[70],
5353
+ b[71]
5354
+ ];
5355
+ bb = bb.concat(window_env_list).concat(b[72]);
5356
+ return rc4_encrypt(String.fromCharCode.apply(null, bb), String.fromCharCode.apply(null, [
5357
+ 121
5358
+ ]));
5359
+ }
5360
+ function generate_random_str() {
5361
+ let random_str_list = [];
5362
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
5363
+ 3,
5364
+ 45
5365
+ ]));
5366
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
5367
+ 1,
5368
+ 0
5369
+ ]));
5370
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
5371
+ 1,
5372
+ 5
5373
+ ]));
5374
+ return String.fromCharCode.apply(null, random_str_list);
5375
+ }
5376
+ function sign(url_search_params, user_agent, arr) {
5377
+ let result_str = generate_random_str() + generate_rc4_bb_str(url_search_params, user_agent, "1536|747|1536|834|0|30|0|0|1536|834|1536|864|1525|747|24|24|Win32", "cus", arr);
5378
+ return result_encrypt(result_str, "s4") + "=";
5379
+ }
5380
+ function sign_datail(params, userAgent) {
5381
+ return sign(params, userAgent, [
5382
+ 0,
5383
+ 1,
5384
+ 14
5385
+ ]);
5386
+ }
5387
+ function sign_reply(params, userAgent) {
5388
+ return sign(params, userAgent, [
5389
+ 0,
5390
+ 1,
5391
+ 8
5392
+ ]);
5393
+ }
5394
+ },
5395
+ "./src/utils/douyin/douyinSign.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5396
+ "use strict";
5397
+ __webpack_require__.r(__webpack_exports__);
5398
+ __webpack_require__.d(__webpack_exports__, {
5399
+ calculateFileCrc32: ()=>calculateFileCrc32,
5400
+ canonicalQueryString: ()=>canonicalQueryString,
5401
+ generateAuthorization: ()=>generateAuthorization,
5402
+ randomS: ()=>randomS
5403
+ });
5404
+ const crypto = __webpack_require__("crypto");
5405
+ const UNSIGNABLE_HEADERS = [
5406
+ 'authorization',
5407
+ 'content-type',
5408
+ 'content-length',
5409
+ 'user-agent',
5410
+ 'presigned-expires',
5411
+ 'expect',
5412
+ 'x-amzn-trace-id'
5413
+ ];
5414
+ function sha256(data) {
5415
+ return crypto.createHash('sha256').update(data, 'utf8').digest('hex');
5416
+ }
5417
+ function hmac(key, data) {
5418
+ return crypto.createHmac('sha256', key).update(data, 'utf8').digest();
5419
+ }
5420
+ function getSigningKey(secretAccessKey, dateStamp, region, service) {
5421
+ const kDate = hmac('AWS4' + secretAccessKey, dateStamp);
5422
+ const kRegion = hmac(kDate, region);
5423
+ const kService = hmac(kRegion, service);
5424
+ const kSigning = hmac(kService, 'aws4_request');
5425
+ return kSigning;
5426
+ }
5427
+ function isSignableHeader(header) {
5428
+ const lowerHeader = header.toLowerCase();
5429
+ return lowerHeader.startsWith('x-amz-') || !UNSIGNABLE_HEADERS.includes(lowerHeader);
5430
+ }
5431
+ function canonicalHeaderValues(value) {
5432
+ return value.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
5433
+ }
5434
+ function canonicalHeaders(headers) {
5435
+ const headerPairs = [];
5436
+ Object.keys(headers).forEach((key)=>{
5437
+ headerPairs.push([
5438
+ key,
5439
+ headers[key]
5440
+ ]);
5441
+ });
5442
+ headerPairs.sort((a, b)=>a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1);
5443
+ const result = [];
5444
+ headerPairs.forEach(([key, value])=>{
5445
+ const lowerKey = key.toLowerCase();
5446
+ if (isSignableHeader(lowerKey)) result.push(`${lowerKey}:${canonicalHeaderValues(value.toString())}`);
5447
+ });
5448
+ return result.join('\n');
5449
+ }
5450
+ function signedHeaders(headers) {
5451
+ const headerNames = [];
5452
+ Object.keys(headers).forEach((key)=>{
5453
+ const lowerKey = key.toLowerCase();
5454
+ if (isSignableHeader(lowerKey)) headerNames.push(lowerKey);
5455
+ });
5456
+ return headerNames.sort().join(';');
5457
+ }
5458
+ function canonicalQueryString(params) {
5459
+ if (!params || 0 === Object.keys(params).length) return '';
5460
+ return Object.keys(params).sort().map((key)=>{
5461
+ const value = params[key];
5462
+ return encodeURIComponent(key) + '=' + encodeURIComponent(String(value));
5463
+ }).join('&');
5464
+ }
5465
+ function iso8601(date) {
5466
+ return date.toISOString().replace(/\.\d{3}Z$/, 'Z');
5467
+ }
5468
+ function randomS() {
5469
+ const pool = '0123456789abcdefghijklmnopqrstuvwxyz';
5470
+ let s = '';
5471
+ for(let i = 0; i < 11; i++)s += pool.charAt(Math.floor(Math.random() * pool.length));
5472
+ return s;
5473
+ }
5474
+ function generateAuthorization(config) {
5475
+ const { accessKeyId, secretAccessKey, sessionToken, region, service, method = 'GET', pathname = '/', params = {}, body = '', headers = {} } = config;
5476
+ const now = new Date();
5477
+ const amzDate = iso8601(now).replace(/[:\-]|\.\d{3}/g, '');
5478
+ const dateStamp = amzDate.substr(0, 8);
5479
+ const requestHeaders = {
5480
+ ...headers,
5481
+ 'X-Amz-Date': amzDate
5482
+ };
5483
+ if (sessionToken) requestHeaders['x-amz-security-token'] = sessionToken;
5484
+ if (body) requestHeaders['X-Amz-Content-Sha256'] = sha256(JSON.stringify(body));
5485
+ const canonicalQueryStr = canonicalQueryString(params);
5486
+ const canonicalHeadersStr = canonicalHeaders(requestHeaders);
5487
+ const signedHeadersStr = signedHeaders(requestHeaders);
5488
+ const payloadHash = body ? sha256(JSON.stringify(body)) : sha256('');
5489
+ const canonicalRequest = [
5490
+ method.toUpperCase(),
5491
+ pathname,
5492
+ canonicalQueryStr,
5493
+ canonicalHeadersStr + '\n',
5494
+ signedHeadersStr,
5495
+ payloadHash
5496
+ ].join('\n');
5497
+ const algorithm = 'AWS4-HMAC-SHA256';
5498
+ const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
5499
+ const canonicalRequestHash = sha256(canonicalRequest);
5500
+ const stringToSign = [
5501
+ algorithm,
5502
+ amzDate,
5503
+ credentialScope,
5504
+ canonicalRequestHash
5505
+ ].join('\n');
5506
+ const signingKey = getSigningKey(secretAccessKey, dateStamp, region, service);
5507
+ const signature = crypto.createHmac('sha256', signingKey).update(stringToSign, 'utf8').digest('hex');
5508
+ const authorization = `${algorithm} Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeadersStr}, Signature=${signature}`;
5509
+ return {
5510
+ authorization,
5511
+ headers: requestHeaders,
5512
+ amzDate
5513
+ };
5514
+ }
5515
+ const fs = __webpack_require__("fs");
5516
+ function calculateFileCrc32(filePath) {
5517
+ const data = fs.readFileSync(filePath);
5518
+ const crc32Value = crc32(data);
5519
+ const crc32Hex = crc32Value.toString(16);
5520
+ return crc32Hex;
5521
+ }
5522
+ function crc32(data) {
5523
+ const CRC_TABLE = [];
5524
+ for(let i = 0; i < 256; i++){
5525
+ let crc = i;
5526
+ for(let j = 0; j < 8; j++)crc = 1 & crc ? 0xEDB88320 ^ crc >>> 1 : crc >>> 1;
5527
+ CRC_TABLE.push(crc >>> 0);
5528
+ }
5529
+ let crc = 0xFFFFFFFF;
5530
+ for(let i = 0; i < data.length; i++){
5531
+ const byte = data[i];
5532
+ const index = (crc ^ byte) & 0xFF;
5533
+ crc = (CRC_TABLE[index] ^ crc >>> 8) >>> 0;
5534
+ }
5535
+ crc = (0xFFFFFFFF ^ crc) >>> 0;
5536
+ return crc;
5537
+ }
5538
+ },
5539
+ "./src/utils/douyin/reqSign.js.js": function(module, __unused_webpack_exports, __webpack_require__) {
5540
+ const crypto = __webpack_require__("crypto");
5541
+ function bufferToHex(buffer) {
5542
+ return buffer.toString('hex');
5543
+ }
5544
+ function generateReqSign(privateKeyPem, data) {
5545
+ try {
5546
+ const privateKey = crypto.createPrivateKey({
5547
+ key: privateKeyPem,
5548
+ format: 'pem',
5549
+ type: 'pkcs8'
5550
+ });
5551
+ const dataBuffer = Buffer.from(data, 'utf8');
5552
+ const signature = crypto.sign('sha256', dataBuffer, {
5553
+ key: privateKey,
5554
+ dsaEncoding: 'der'
5555
+ });
5556
+ return bufferToHex(signature);
5557
+ } catch (error) {
5558
+ console.error('req_sign 生成失败:', error);
5559
+ throw error;
5560
+ }
5561
+ }
5562
+ function generateReqSignFromTicket(ticket, privateKeyPem) {
5563
+ return generateReqSign(privateKeyPem, ticket);
5564
+ }
5565
+ function generateReqSignFromSignData(signData, privateKeyPem) {
5566
+ return generateReqSign(privateKeyPem, signData);
5567
+ }
5568
+ module.exports = {
5569
+ generateReqSign,
5570
+ generateReqSignFromTicket,
5571
+ generateReqSignFromSignData
5572
+ };
5573
+ },
4940
5574
  "./src/utils/ttABEncrypt.js": function(module, __unused_webpack_exports, __webpack_require__) {
4941
5575
  module = __webpack_require__.nmd(module);
4942
5576
  const a0_0x45db08 = a0_0x4b0d;
@@ -7438,6 +8072,10 @@ var __webpack_modules__ = {
7438
8072
  "use strict";
7439
8073
  module.exports = require("assert");
7440
8074
  },
8075
+ crypto: function(module) {
8076
+ "use strict";
8077
+ module.exports = require("crypto");
8078
+ },
7441
8079
  fs: function(module) {
7442
8080
  "use strict";
7443
8081
  module.exports = require("fs");
@@ -7556,16 +8194,28 @@ var __webpack_exports__ = {};
7556
8194
  "use strict";
7557
8195
  __webpack_require__.r(__webpack_exports__);
7558
8196
  __webpack_require__.d(__webpack_exports__, {
7559
- Http: ()=>Http,
7560
- SearchAccountInfoParamsSchema: ()=>SearchAccountInfoParamsSchema,
8197
+ DouyinGetMusicByCategoryParamsSchema: ()=>DouyinGetMusicByCategoryParamsSchema,
7561
8198
  rpaAction_Server_Mock: ()=>rpaAction_Server_Mock,
7562
8199
  ConfigDataSchema: ()=>ConfigDataSchema,
7563
8200
  XhsWebSearchParamsSchema: ()=>XhsWebSearchParamsSchema,
7564
8201
  ttConfigDataSchema: ()=>ttConfigDataSchema,
7565
8202
  getFileState: ()=>getFileState,
8203
+ DouyinPublishParamsSchema: ()=>DouyinPublishParamsSchema,
8204
+ DouyinGetMusicCategoryParamsSchema: ()=>DouyinGetMusicCategoryParamsSchema,
7566
8205
  xhsConfigDataSchema: ()=>xhsConfigDataSchema,
7567
- UnreadCountSchema: ()=>UnreadCountSchema,
7568
8206
  SessionCheckResultSchema: ()=>SessionCheckResultSchema,
8207
+ DouyinGetHotParamsSchema: ()=>DouyinGetHotParamsSchema,
8208
+ DouyinGetMusicParamsSchema: ()=>DouyinGetMusicParamsSchema,
8209
+ FetchArticlesDataSchema: ()=>FetchArticlesDataSchema,
8210
+ FetchArticlesParamsSchema: ()=>FetchArticlesParamsSchema,
8211
+ XiaohongshuPublishParamsSchema: ()=>XiaohongshuPublishParamsSchema,
8212
+ wxConfigDataSchema: ()=>wxConfigDataSchema,
8213
+ Http: ()=>Http,
8214
+ DouyinGetLocationParamsSchema: ()=>DouyinGetLocationParamsSchema,
8215
+ SearchAccountInfoParamsSchema: ()=>SearchAccountInfoParamsSchema,
8216
+ DouyinGetCollectionParamsSchema: ()=>DouyinGetCollectionParamsSchema,
8217
+ DouyinGetTopicsParamsSchema: ()=>DouyinGetTopicsParamsSchema,
8218
+ UnreadCountSchema: ()=>UnreadCountSchema,
7569
8219
  ActionCommonParamsSchema: ()=>ActionCommonParamsSchema,
7570
8220
  ToutiaoPublishParamsSchema: ()=>ToutiaoPublishParamsSchema,
7571
8221
  WeixinPublishParamsSchema: ()=>WeixinPublishParamsSchema,
@@ -7574,13 +8224,9 @@ var __webpack_exports__ = {};
7574
8224
  BetaFlag: ()=>BetaFlag,
7575
8225
  bjhConfigDataSchema: ()=>bjhConfigDataSchema,
7576
8226
  BaijiahaoPublishParamsSchema: ()=>BaijiahaoPublishParamsSchema,
7577
- FetchArticlesDataSchema: ()=>FetchArticlesDataSchema,
7578
- FetchArticlesParamsSchema: ()=>FetchArticlesParamsSchema,
7579
- Action: ()=>Action,
7580
- ProxyAgent: ()=>ProxyAgent,
7581
- XiaohongshuPublishParamsSchema: ()=>XiaohongshuPublishParamsSchema,
7582
8227
  version: ()=>package_namespaceObject_0.i8,
7583
- wxConfigDataSchema: ()=>wxConfigDataSchema
8228
+ Action: ()=>Action,
8229
+ ProxyAgent: ()=>ProxyAgent
7584
8230
  });
7585
8231
  var common_utils_namespaceObject = {};
7586
8232
  __webpack_require__.r(common_utils_namespaceObject);
@@ -7592,7 +8238,7 @@ var __webpack_exports__ = {};
7592
8238
  origin: ()=>utils_origin
7593
8239
  });
7594
8240
  var package_namespaceObject = JSON.parse('{"i8":"0.0.18-beta.0"}');
7595
- var package_namespaceObject_0 = JSON.parse('{"i8":"1.2.32-beta.0"}');
8241
+ var package_namespaceObject_0 = JSON.parse('{"i8":"2.0.0-beta.1"}');
7596
8242
  const external_node_fs_namespaceObject = require("node:fs");
7597
8243
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
7598
8244
  const external_node_https_namespaceObject = require("node:https");
@@ -7737,7 +8383,7 @@ var __webpack_exports__ = {};
7737
8383
  message: message || "操作成功",
7738
8384
  data
7739
8385
  });
7740
- const randomString = (length)=>{
8386
+ const dist_randomString = (length)=>{
7741
8387
  let T = "";
7742
8388
  const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
7743
8389
  for(let de = 0; de < length; de++)T += H.charAt(Math.floor(Math.random() * H.length));
@@ -29229,83 +29875,611 @@ var __webpack_exports__ = {};
29229
29875
  };
29230
29876
  return success(data, message);
29231
29877
  };
29232
- const douyinLogin_rpa_server_scanRetryMaxCount = 60;
29233
- const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
29234
- const rpa_server_rpaServer = async (task, params)=>{
29235
- const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
29236
- let executionState;
29237
- let proxyUrl;
29238
- if (params.localIP) {
29239
- const args = [
29240
- params.localIP,
29241
- params.proxyLoc,
29242
- params.accountId
29243
- ];
29244
- task.logger?.info(`==> 开始获取代理信息:${args}`);
29245
- const ProxyAgentWithLogger = ProxyAgent.bind({
29246
- logger: task.logger
29247
- });
29248
- const ProxyAgentResult = await ProxyAgentWithLogger(...args);
29249
- task.logger?.info("==> 代理信息获取成功!");
29250
- proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
29251
- }
29252
- const page = await task.createPage({
29253
- url: "https://creator.douyin.com/",
29254
- proxyUrl,
29255
- userAgent: params.userAgent,
29256
- ...params.viewport ? {
29257
- viewport: params.viewport
29258
- } : {}
29259
- });
29260
- await page.route("**/*.mp4", (route)=>route.abort());
29261
- await page.route("**/*.png", (route)=>route.abort());
29262
- await page.route("**/*.ttf", (route)=>route.abort());
29263
- await page.addInitScript(()=>{
29264
- window.requestAnimationFrame = ()=>0;
29265
- });
29266
- task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
29267
- await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
29268
- timeout: 15000
29878
+ const DySessionCheck = async (_task, params)=>{
29879
+ const http = new Http({
29880
+ headers: {
29881
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
29882
+ referer: "https://creator.douyin.com/",
29883
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
29884
+ }
29269
29885
  });
29270
- await page.waitForLoadState("networkidle");
29271
- await page.goto("about:blank");
29272
- await page.goBack({
29273
- waitUntil: "domcontentloaded"
29886
+ const res = await http.api({
29887
+ method: "get",
29888
+ url: "https://creator.douyin.com/aweme/v1/creator/user/info/",
29889
+ params: {
29890
+ _ts: Date.now()
29891
+ },
29892
+ defaultErrorMsg: "抖音登录状态失效。"
29274
29893
  });
29275
- task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
29276
- await page.locator(".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle").click();
29277
- task.steelBrowser?.on("disconnected", async ()=>{
29278
- const browserContext = task.steelBrowserContext;
29279
- const browser = task.steelBrowser;
29280
- executionState = types_ExecutionState.BROWSER_CLOSED;
29281
- await page.close();
29282
- if (browserContext) await browserContext.close();
29283
- if (browser) await browser.close();
29894
+ const isSuccess = 0 === res.status_code;
29895
+ const message = "抖音账号有效性检测成功";
29896
+ const data = isSuccess ? {
29897
+ isValidSession: true
29898
+ } : {
29899
+ isValidSession: false
29900
+ };
29901
+ return success(data, message);
29902
+ };
29903
+ const DouyinGetCollectionParamsSchema = ActionCommonParamsSchema.extend({
29904
+ keyword: classic_schemas_string().optional(),
29905
+ count: classic_schemas_number().optional()
29906
+ });
29907
+ const { sign_datail, sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
29908
+ const douyinGetCollection = async (_task, params)=>{
29909
+ const headers = {
29910
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
29911
+ referer: "https://creator.douyin.com/",
29912
+ origin: "https://creator.douyin.com/"
29913
+ };
29914
+ const args = [
29915
+ {
29916
+ headers
29917
+ },
29918
+ _task.logger,
29919
+ params.proxyLoc,
29920
+ params.localIP,
29921
+ params.accountId
29922
+ ];
29923
+ const http = new Http(...args);
29924
+ const collectionParams = {
29925
+ status: "0,2",
29926
+ count: "50",
29927
+ cursor: "0",
29928
+ source: "collection_create",
29929
+ aid: "1128",
29930
+ cookie_enabled: "true",
29931
+ screen_width: "1920",
29932
+ screen_height: "1200",
29933
+ browser_language: "zh-CN",
29934
+ browser_platform: "Win32",
29935
+ browser_name: "Mozilla",
29936
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
29937
+ browser_online: "true",
29938
+ timezone_name: "Asia/Shanghai",
29939
+ support_h265: "1",
29940
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
29941
+ a_bogus: ""
29942
+ };
29943
+ const aBogus = sign_reply(collectionParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
29944
+ collectionParams.a_bogus = aBogus;
29945
+ const queryString = new URLSearchParams(collectionParams).toString();
29946
+ const res = await http.api({
29947
+ method: "get",
29948
+ url: `https://creator.douyin.com/web/api/mix/list/?${queryString}`,
29949
+ headers: {
29950
+ ...headers,
29951
+ "Content-Type": "application/json"
29952
+ }
29953
+ }, {
29954
+ retries: 3,
29955
+ retryDelay: 20,
29956
+ timeout: 3000
29284
29957
  });
29285
- await updateTaskState?.({
29286
- state: types_TaskState.WAIT_SCAN,
29287
- connectAddress: await task.steelConnector?.getLive(task.sessionId || ""),
29288
- sessionId: task.sessionId
29958
+ const isSuccess = 0 === res.status_code;
29959
+ const message = `抖音获取合集${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
29960
+ const data = isSuccess ? {
29961
+ collections: res?.mix_list || [],
29962
+ total: res?.mix_list?.length || 0
29963
+ } : {
29964
+ collections: [],
29965
+ total: 0
29966
+ };
29967
+ return utils_response(isSuccess ? 0 : 414, message, data);
29968
+ };
29969
+ const DouyinGetHotParamsSchema = ActionCommonParamsSchema.extend({
29970
+ query: classic_schemas_string().optional(),
29971
+ count: classic_schemas_number().optional()
29972
+ });
29973
+ const { sign_datail: douyinGetHot_sign_datail, sign_reply: douyinGetHot_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
29974
+ const douyinGetHot = async (_task, params)=>{
29975
+ const headers = {
29976
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
29977
+ referer: "https://creator.douyin.com/",
29978
+ origin: "https://creator.douyin.com/"
29979
+ };
29980
+ const args = [
29981
+ {
29982
+ headers
29983
+ },
29984
+ _task.logger,
29985
+ params.proxyLoc,
29986
+ params.localIP,
29987
+ params.accountId
29988
+ ];
29989
+ const http = new Http(...args);
29990
+ const hotParams = {
29991
+ query: params.query || "",
29992
+ count: "50",
29993
+ aid: "1128",
29994
+ cookie_enabled: "0",
29995
+ screen_width: "1920",
29996
+ screen_height: "1200",
29997
+ browser_language: "zh-CN",
29998
+ browser_platform: "Win32",
29999
+ browser_name: "Mozilla",
30000
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30001
+ browser_online: "true",
30002
+ timezone_name: "Asia/Shanghai",
30003
+ support_h265: "1",
30004
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
30005
+ a_bogus: ""
30006
+ };
30007
+ const aBogus = douyinGetHot_sign_reply(hotParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30008
+ hotParams.a_bogus = aBogus;
30009
+ const queryString = new URLSearchParams(hotParams).toString();
30010
+ console.log("抖音获取热点参数:", queryString);
30011
+ const res = await http.api({
30012
+ method: "get",
30013
+ url: `https://creator.douyin.com/aweme/v1/hotspot/search/?${queryString}`,
30014
+ headers: {
30015
+ ...headers,
30016
+ "Content-Type": "application/json"
30017
+ }
30018
+ }, {
30019
+ retries: 3,
30020
+ retryDelay: 20,
30021
+ timeout: 3000
29289
30022
  });
29290
- const userInfo = {
29291
- uniqueId: "",
29292
- avatar: "",
29293
- name: ""
30023
+ const isSuccess = 0 === res.status_code;
30024
+ const message = `抖音获取热点${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30025
+ const data = isSuccess ? {
30026
+ hot: res?.sentences || [],
30027
+ total: res?.sentences?.length || 0
30028
+ } : {
30029
+ hot: [],
30030
+ total: 0
29294
30031
  };
29295
- try {
29296
- await new Promise((resolve, reject)=>{
29297
- let finished = false;
29298
- const timer = setTimeout(async ()=>{
29299
- cleanup();
29300
- executionState = types_ExecutionState.TIMEOUT;
29301
- await updateTaskState?.({
29302
- state: types_TaskState.TIMEOUT,
29303
- error: "等待扫码登录超时"
29304
- });
29305
- resolve();
29306
- }, douyinLogin_rpa_server_waitQrcodeResultMaxTime);
29307
- const cleanup = ()=>{
29308
- if (finished) return;
30032
+ console.log("抖音获取热点数据:", data);
30033
+ return utils_response(isSuccess ? 0 : 414, message, data);
30034
+ };
30035
+ const DouyinGetLocationParamsSchema = ActionCommonParamsSchema.extend({
30036
+ keyword: classic_schemas_string().optional(),
30037
+ count: classic_schemas_number().optional()
30038
+ });
30039
+ const { sign_datail: douyinGetLocation_sign_datail, sign_reply: douyinGetLocation_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30040
+ const douyinGetLocation = async (_task, params)=>{
30041
+ const headers = {
30042
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30043
+ referer: "https://creator.douyin.com/",
30044
+ origin: "https://creator.douyin.com/"
30045
+ };
30046
+ const args = [
30047
+ {
30048
+ headers
30049
+ },
30050
+ _task.logger,
30051
+ params.proxyLoc,
30052
+ params.localIP,
30053
+ params.accountId
30054
+ ];
30055
+ const http = new Http(...args);
30056
+ const keyword = params.keyword || "";
30057
+ const locationParams = {
30058
+ count: "1",
30059
+ from_webapp: "1",
30060
+ get_current_loc: "1",
30061
+ is_image_album_style: "1",
30062
+ search_type: "0",
30063
+ poi_anchor_tab: "2",
30064
+ page: "1",
30065
+ keyword: keyword,
30066
+ poi_mode: "{}",
30067
+ load_interest_city_type: "0",
30068
+ aid: "1128",
30069
+ cookie_enabled: "true",
30070
+ screen_width: "1920",
30071
+ screen_height: "1200",
30072
+ browser_language: "zh-CN",
30073
+ browser_platform: "Win32",
30074
+ browser_name: "Mozilla",
30075
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30076
+ browser_online: "true",
30077
+ timezone_name: "Asia/Shanghai",
30078
+ support_h265: "1",
30079
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
30080
+ a_bogus: ""
30081
+ };
30082
+ const aBogus = douyinGetLocation_sign_reply(locationParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30083
+ locationParams.a_bogus = aBogus;
30084
+ const queryString = new URLSearchParams(locationParams).toString();
30085
+ const res = await http.api({
30086
+ method: "get",
30087
+ url: `https://creator.douyin.com/aweme/v1/life/video_api/search/poi/?${queryString}`,
30088
+ headers: {
30089
+ ...headers,
30090
+ "Content-Type": "application/json"
30091
+ }
30092
+ }, {
30093
+ retries: 3,
30094
+ retryDelay: 20,
30095
+ timeout: 3000
30096
+ });
30097
+ console.log("抖音获取位置响应:", res);
30098
+ const isSuccess = 0 === res.status_code;
30099
+ const message = `抖音获取位置${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30100
+ let locations = [];
30101
+ if (isSuccess && res?.poi_list) {
30102
+ if (Array.isArray(res.poi_list) && res.poi_list.length > 0) locations = Array.isArray(res.poi_list[0]) ? res.poi_list[0] : res.poi_list;
30103
+ }
30104
+ const data = {
30105
+ locations,
30106
+ total: locations.length
30107
+ };
30108
+ return utils_response(isSuccess ? 0 : 414, message, data);
30109
+ };
30110
+ const DouyinGetMusicParamsSchema = ActionCommonParamsSchema.extend({
30111
+ keyword: classic_schemas_string().optional(),
30112
+ count: classic_schemas_number().optional()
30113
+ });
30114
+ const { sign_datail: douyinGetMusic_sign_datail, sign_reply: douyinGetMusic_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30115
+ const douyinGetMusic = async (_task, params)=>{
30116
+ const headers = {
30117
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30118
+ referer: "https://creator.douyin.com/",
30119
+ origin: "https://creator.douyin.com/"
30120
+ };
30121
+ const args = [
30122
+ {
30123
+ headers
30124
+ },
30125
+ _task.logger,
30126
+ params.proxyLoc,
30127
+ params.localIP,
30128
+ params.accountId
30129
+ ];
30130
+ const http = new Http(...args);
30131
+ const keyword = params.keyword || "";
30132
+ const musicParams = {
30133
+ keyword: keyword || "11",
30134
+ search_source: "normal_search",
30135
+ cout: "20",
30136
+ aid: "1128",
30137
+ cursor: "0",
30138
+ cookie_enabled: "true",
30139
+ screen_width: "1920",
30140
+ screen_height: "1200",
30141
+ browser_language: "zh-CN",
30142
+ browser_platform: "Win32",
30143
+ browser_name: "Mozilla",
30144
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30145
+ browser_online: "true",
30146
+ timezone_name: "Asia/Shanghai",
30147
+ support_h265: "1",
30148
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
30149
+ a_bogus: ""
30150
+ };
30151
+ const aBogus = douyinGetMusic_sign_reply(musicParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30152
+ musicParams.a_bogus = aBogus;
30153
+ const queryString = new URLSearchParams(musicParams).toString();
30154
+ console.log("抖音获取音乐参数:", queryString);
30155
+ const authorizationParams = {
30156
+ aid: "1128",
30157
+ cookie_enabled: "true",
30158
+ screen_width: "1920",
30159
+ screen_height: "1200",
30160
+ browser_language: "zh-CN",
30161
+ browser_platform: "Win32",
30162
+ browser_name: "Mozilla",
30163
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30164
+ browser_online: "true",
30165
+ timezone_name: "Asia/Shanghai",
30166
+ support_h265: "1"
30167
+ };
30168
+ const authorizationQueryString = new URLSearchParams(authorizationParams).toString();
30169
+ const authorization = await http.api({
30170
+ method: "get",
30171
+ url: `https://creator.douyin.com/web/api/media/aweme/search/post/auth/?${authorizationQueryString}`,
30172
+ headers: {
30173
+ ...headers,
30174
+ "Content-Type": "application/json"
30175
+ }
30176
+ }, {
30177
+ retries: 3,
30178
+ retryDelay: 20,
30179
+ timeout: 3000
30180
+ });
30181
+ if (0 !== authorization.status_code) return utils_response(414, authorization.status_msg, {
30182
+ music: [],
30183
+ total: 0
30184
+ });
30185
+ console.log("抖音获取音乐权限:", authorization);
30186
+ const res = await http.api({
30187
+ method: "get",
30188
+ url: `https://tsearch.amemv.com/openapi/aweme/v1/music/search/?${queryString}`,
30189
+ headers: {
30190
+ ...headers,
30191
+ "agw-auth": authorization?.signature || "",
30192
+ "Content-Type": "application/json"
30193
+ }
30194
+ }, {
30195
+ retries: 3,
30196
+ retryDelay: 20,
30197
+ timeout: 3000
30198
+ });
30199
+ console.log("抖音获取音乐响应:", res);
30200
+ const isSuccess = 0 === res.status_code;
30201
+ const message = `抖音获取音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30202
+ const data = isSuccess ? {
30203
+ music: res?.music || [],
30204
+ total: res?.music?.length || 0
30205
+ } : {
30206
+ music: [],
30207
+ total: 0
30208
+ };
30209
+ return utils_response(isSuccess ? 0 : 414, message, data);
30210
+ };
30211
+ const DouyinGetMusicByCategoryParamsSchema = ActionCommonParamsSchema.extend({
30212
+ category_id: classic_schemas_string().optional(),
30213
+ type: classic_schemas_string().optional(),
30214
+ count: classic_schemas_number().optional()
30215
+ });
30216
+ const { sign_datail: douyinGetMusicByCategory_sign_datail, sign_reply: douyinGetMusicByCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30217
+ const douyinGetMusicByCategory = async (_task, params)=>{
30218
+ const headers = {
30219
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30220
+ referer: "https://creator.douyin.com/",
30221
+ origin: "https://creator.douyin.com/"
30222
+ };
30223
+ const args = [
30224
+ {
30225
+ headers
30226
+ },
30227
+ _task.logger,
30228
+ params.proxyLoc,
30229
+ params.localIP,
30230
+ params.accountId
30231
+ ];
30232
+ const http = new Http(...args);
30233
+ const collectionParams = {
30234
+ status: "0,2",
30235
+ count: params.count?.toString() || "20",
30236
+ cursor: "0",
30237
+ source: "collection_create",
30238
+ aid: "1128",
30239
+ cookie_enabled: "true",
30240
+ screen_width: "1920",
30241
+ screen_height: "1200",
30242
+ browser_language: "zh-CN",
30243
+ browser_platform: "Win32",
30244
+ browser_name: "Mozilla",
30245
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30246
+ browser_online: "true",
30247
+ timezone_name: "Asia/Shanghai",
30248
+ support_h265: "1",
30249
+ type: params.type || "",
30250
+ category_id: params.category_id || "",
30251
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
30252
+ a_bogus: ""
30253
+ };
30254
+ const aBogus = douyinGetMusicByCategory_sign_reply(collectionParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30255
+ collectionParams.a_bogus = aBogus;
30256
+ const queryString = new URLSearchParams(collectionParams).toString();
30257
+ const res = await http.api({
30258
+ method: "get",
30259
+ url: `https://creator.douyin.com/web/api/media/music/list/?${queryString}`,
30260
+ headers: {
30261
+ ...headers,
30262
+ "Content-Type": "application/json"
30263
+ }
30264
+ }, {
30265
+ retries: 3,
30266
+ retryDelay: 20,
30267
+ timeout: 3000
30268
+ });
30269
+ const isSuccess = 0 === res.status_code;
30270
+ const message = `抖音获取推荐音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30271
+ const data = isSuccess ? {
30272
+ songs: res?.songs || []
30273
+ } : {
30274
+ songs: []
30275
+ };
30276
+ return utils_response(isSuccess ? 0 : 414, message, data);
30277
+ };
30278
+ const { sign_datail: douyinGetMusicCategory_sign_datail, sign_reply: douyinGetMusicCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30279
+ const DouyinGetMusicCategoryParamsSchema = ActionCommonParamsSchema.extend({});
30280
+ const douyinGetMusicCategory = async (_task, params)=>{
30281
+ const headers = {
30282
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30283
+ referer: "https://creator.douyin.com/",
30284
+ origin: "https://creator.douyin.com/"
30285
+ };
30286
+ const args = [
30287
+ {
30288
+ headers
30289
+ },
30290
+ _task.logger,
30291
+ params.proxyLoc,
30292
+ params.localIP,
30293
+ params.accountId
30294
+ ];
30295
+ const http = new Http(...args);
30296
+ const categoryParams = {
30297
+ status: "0,2",
30298
+ count: "50",
30299
+ cursor: "0",
30300
+ source: "collection_create",
30301
+ aid: "1128",
30302
+ cookie_enabled: "true",
30303
+ screen_width: "1920",
30304
+ screen_height: "1200",
30305
+ browser_language: "zh-CN",
30306
+ browser_platform: "Win32",
30307
+ browser_name: "Mozilla",
30308
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30309
+ browser_online: "true",
30310
+ timezone_name: "Asia/Shanghai",
30311
+ support_h265: "1",
30312
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
30313
+ a_bogus: ""
30314
+ };
30315
+ const aBogus = douyinGetMusicCategory_sign_reply(categoryParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30316
+ categoryParams.a_bogus = aBogus;
30317
+ const queryString = new URLSearchParams(categoryParams).toString();
30318
+ const res = await http.api({
30319
+ method: "get",
30320
+ url: `https://creator.douyin.com/web/api/media/music/category?${queryString}`,
30321
+ headers: {
30322
+ ...headers,
30323
+ "Content-Type": "application/json"
30324
+ }
30325
+ }, {
30326
+ retries: 3,
30327
+ retryDelay: 20,
30328
+ timeout: 3000
30329
+ });
30330
+ const isSuccess = 0 === res.status_code;
30331
+ const message = `抖音获取音乐分类${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30332
+ const data = isSuccess ? {
30333
+ categorys: res?.categories || []
30334
+ } : {
30335
+ categorys: []
30336
+ };
30337
+ return utils_response(isSuccess ? 0 : 414, message, data);
30338
+ };
30339
+ const DouyinGetTopicsParamsSchema = ActionCommonParamsSchema.extend({
30340
+ keyword: classic_schemas_string().optional(),
30341
+ count: classic_schemas_number().optional()
30342
+ });
30343
+ const { sign_datail: douyinGetTopics_sign_datail, sign_reply: douyinGetTopics_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30344
+ const douyinGetTopics = async (_task, params)=>{
30345
+ const headers = {
30346
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30347
+ referer: "https://creator.douyin.com/",
30348
+ origin: "https://creator.douyin.com/"
30349
+ };
30350
+ const args = [
30351
+ {
30352
+ headers
30353
+ },
30354
+ _task.logger,
30355
+ params.proxyLoc,
30356
+ params.localIP,
30357
+ params.accountId
30358
+ ];
30359
+ const http = new Http(...args);
30360
+ const keyword = params.keyword || "";
30361
+ const topicParams = {
30362
+ keyword: keyword,
30363
+ source: "challenge_create",
30364
+ aid: "2906",
30365
+ cookie_enabled: "0",
30366
+ screen_width: "1920",
30367
+ screen_height: "1200",
30368
+ browser_language: "zh-CN",
30369
+ browser_platform: "Win32",
30370
+ browser_name: "Mozilla",
30371
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30372
+ browser_online: "true",
30373
+ timezone_name: "Asia/Shanghai",
30374
+ support_h265: "1",
30375
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
30376
+ a_bogus: ""
30377
+ };
30378
+ const aBogus = douyinGetTopics_sign_reply(topicParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30379
+ topicParams.a_bogus = aBogus;
30380
+ const queryString = new URLSearchParams(topicParams).toString();
30381
+ console.log("抖音获取话题参数:", queryString);
30382
+ const res = await http.api({
30383
+ method: "get",
30384
+ url: `https://creator.douyin.com/aweme/v1/search/challengesug/?${queryString}`,
30385
+ headers: {
30386
+ ...headers,
30387
+ "Content-Type": "application/json"
30388
+ }
30389
+ }, {
30390
+ retries: 3,
30391
+ retryDelay: 20,
30392
+ timeout: 3000
30393
+ });
30394
+ console.log("抖音获取话题响应:", res);
30395
+ const isSuccess = 0 === res.status_code;
30396
+ const message = `抖音获取话题${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30397
+ const data = isSuccess ? {
30398
+ topics: res?.sug_list || [],
30399
+ total: res?.sug_list?.length || 0
30400
+ } : {
30401
+ topics: [],
30402
+ total: 0
30403
+ };
30404
+ return utils_response(isSuccess ? 0 : 414, message, data);
30405
+ };
30406
+ const douyinLogin_rpa_server_scanRetryMaxCount = 60;
30407
+ const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
30408
+ const rpa_server_rpaServer = async (task, params)=>{
30409
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
30410
+ let executionState;
30411
+ let proxyUrl;
30412
+ if (params.localIP) {
30413
+ const args = [
30414
+ params.localIP,
30415
+ params.proxyLoc,
30416
+ params.accountId
30417
+ ];
30418
+ task.logger?.info(`==> 开始获取代理信息:${args}`);
30419
+ const ProxyAgentWithLogger = ProxyAgent.bind({
30420
+ logger: task.logger
30421
+ });
30422
+ const ProxyAgentResult = await ProxyAgentWithLogger(...args);
30423
+ task.logger?.info("==> 代理信息获取成功!");
30424
+ proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
30425
+ }
30426
+ const page = await task.createPage({
30427
+ url: "https://creator.douyin.com/",
30428
+ proxyUrl,
30429
+ userAgent: params.userAgent,
30430
+ ...params.viewport ? {
30431
+ viewport: params.viewport
30432
+ } : {}
30433
+ });
30434
+ await page.route("**/*.mp4", (route)=>route.abort());
30435
+ await page.route("**/*.png", (route)=>route.abort());
30436
+ await page.route("**/*.ttf", (route)=>route.abort());
30437
+ await page.addInitScript(()=>{
30438
+ window.requestAnimationFrame = ()=>0;
30439
+ });
30440
+ task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
30441
+ await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
30442
+ timeout: 15000
30443
+ });
30444
+ await page.waitForLoadState("networkidle");
30445
+ await page.goto("about:blank");
30446
+ await page.goBack({
30447
+ waitUntil: "domcontentloaded"
30448
+ });
30449
+ task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
30450
+ await page.locator(".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle").click();
30451
+ task.steelBrowser?.on("disconnected", async ()=>{
30452
+ const browserContext = task.steelBrowserContext;
30453
+ const browser = task.steelBrowser;
30454
+ executionState = types_ExecutionState.BROWSER_CLOSED;
30455
+ await page.close();
30456
+ if (browserContext) await browserContext.close();
30457
+ if (browser) await browser.close();
30458
+ });
30459
+ await updateTaskState?.({
30460
+ state: types_TaskState.WAIT_SCAN,
30461
+ connectAddress: await task.steelConnector?.getLive(task.sessionId || ""),
30462
+ sessionId: task.sessionId
30463
+ });
30464
+ const userInfo = {
30465
+ uniqueId: "",
30466
+ avatar: "",
30467
+ name: ""
30468
+ };
30469
+ try {
30470
+ await new Promise((resolve, reject)=>{
30471
+ let finished = false;
30472
+ const timer = setTimeout(async ()=>{
30473
+ cleanup();
30474
+ executionState = types_ExecutionState.TIMEOUT;
30475
+ await updateTaskState?.({
30476
+ state: types_TaskState.TIMEOUT,
30477
+ error: "等待扫码登录超时"
30478
+ });
30479
+ resolve();
30480
+ }, douyinLogin_rpa_server_waitQrcodeResultMaxTime);
30481
+ const cleanup = ()=>{
30482
+ if (finished) return;
29309
30483
  finished = true;
29310
30484
  clearTimeout(timer);
29311
30485
  page.off("response", handleWebCommon);
@@ -29428,21 +30602,42 @@ var __webpack_exports__ = {};
29428
30602
  };
29429
30603
  }
29430
30604
  case types_ExecutionState.SUCCESS:
29431
- await updateTaskState?.({
29432
- state: types_TaskState.SUCCESS,
29433
- result: {
29434
- cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
29435
- userInfo: userInfo
29436
- }
29437
- });
29438
- return {
29439
- code: 0,
29440
- message: "成功",
29441
- data: {
29442
- cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
29443
- userInfo
30605
+ {
30606
+ let securityData = {};
30607
+ try {
30608
+ securityData = await page.evaluate(()=>({
30609
+ "security-sdk/s_sdk_pri_key": localStorage.getItem("security-sdk/s_sdk_pri_key") || "",
30610
+ "security-sdk/s_sdk_pub_key": localStorage.getItem("security-sdk/s_sdk_pub_key") || "",
30611
+ "security-sdk/s_sdk_sign_data_key": localStorage.getItem("security-sdk/s_sdk_sign_data_key/web_protect") || ""
30612
+ }));
30613
+ task.logger.info("Security SDK 数据提取成功:", {
30614
+ "security-sdk/s_sdk_pri_key": !!securityData["security-sdk/s_sdk_pri_key"],
30615
+ "security-sdk/s_sdk_pub_key": !!securityData["security-sdk/s_sdk_pub_key"],
30616
+ "security-sdk/s_sdk_sign_data_key": !!securityData["security-sdk/s_sdk_sign_data_key"]
30617
+ });
30618
+ } catch (error) {
30619
+ task.logger.warn("提取 Security SDK 数据失败:", {
30620
+ error: error instanceof Error ? error.message : String(error)
30621
+ });
29444
30622
  }
29445
- };
30623
+ await updateTaskState?.({
30624
+ state: types_TaskState.SUCCESS,
30625
+ result: {
30626
+ cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
30627
+ ...securityData,
30628
+ userInfo: userInfo
30629
+ }
30630
+ });
30631
+ return {
30632
+ code: 0,
30633
+ message: "成功",
30634
+ data: {
30635
+ cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
30636
+ ...securityData,
30637
+ userInfo
30638
+ }
30639
+ };
30640
+ }
29446
30641
  default:
29447
30642
  return {
29448
30643
  code: 500,
@@ -29456,6 +30651,472 @@ var __webpack_exports__ = {};
29456
30651
  if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
29457
30652
  return executeAction(rpa_server_rpaServer)(task, params);
29458
30653
  };
30654
+ const { sign_reply: mock_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
30655
+ const { generateReqSignFromTicket } = __webpack_require__("./src/utils/douyin/reqSign.js.js");
30656
+ const { generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/csrfToken.js");
30657
+ const { generateAuthorization, randomS, canonicalQueryString, calculateFileCrc32 } = __webpack_require__("./src/utils/douyin/douyinSign.js");
30658
+ const mock_mockAction = async (task, params)=>{
30659
+ const tmpCachePath = task.getTmpPath();
30660
+ let bdTicketGuardClientDataV2 = params.cookies.find((e)=>"bd_ticket_guard_client_data" === e.name)?.value || "";
30661
+ if (!bdTicketGuardClientDataV2) return utils_response(400, "bdTicketGuardClientDataV2 不能为空", "");
30662
+ bdTicketGuardClientDataV2 = decodeURIComponent(bdTicketGuardClientDataV2);
30663
+ console.log("原始 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
30664
+ try {
30665
+ bdTicketGuardClientDataV2 = atob(bdTicketGuardClientDataV2);
30666
+ console.log("解码后 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
30667
+ } catch (error) {
30668
+ console.error("bdTicketGuardClientDataV2 解码失败:", error);
30669
+ return utils_response(500, "bdTicketGuardClientDataV2 解码失败", "");
30670
+ }
30671
+ let ree_public_key = "";
30672
+ let ts_sign = "";
30673
+ try {
30674
+ const parsed = JSON.parse(bdTicketGuardClientDataV2);
30675
+ ree_public_key = parsed.ree_public_key || "";
30676
+ ts_sign = parsed.ts_sign || "";
30677
+ } catch {}
30678
+ const privateKey = params["security-sdk/s_sdk_pri_key"]?.data || "";
30679
+ const publicKey = params["security-sdk/s_sdk_pub_key"]?.data || "";
30680
+ const signData = JSON.parse(params["security-sdk/s_sdk_sign_data_key/web_protect"]?.data || "{}");
30681
+ console.log("privateKey:", privateKey);
30682
+ console.log("publicKey:", publicKey);
30683
+ console.log("signData:", signData);
30684
+ let bdTicketGuardClientData = {
30685
+ ts_sign,
30686
+ req_content: "ticket,path,timestamp",
30687
+ timestamp: Math.floor(Date.now() / 1000),
30688
+ req_sign: generateReqSignFromTicket(signData.ticket, privateKey)
30689
+ };
30690
+ console.log("bdTicketGuardClientData:", bdTicketGuardClientData);
30691
+ bdTicketGuardClientData = btoa(JSON.stringify(bdTicketGuardClientData));
30692
+ const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
30693
+ if (!sessionidCookie) return {
30694
+ code: 414,
30695
+ message: "账号数据异常,请重新绑定账号后重试。",
30696
+ data: ""
30697
+ };
30698
+ const headers = {
30699
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30700
+ origin: "https://creator.douyin.com",
30701
+ referer: "https://creator.douyin.com/",
30702
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
30703
+ };
30704
+ const publishParams = {
30705
+ read_aid: "2906",
30706
+ aid: "1128",
30707
+ cookie_enabled: "true",
30708
+ screen_width: "1920",
30709
+ screen_height: "1200",
30710
+ browser_language: "zh-CN",
30711
+ browser_platform: "Win32",
30712
+ browser_name: "Mozilla",
30713
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
30714
+ browser_online: "true",
30715
+ timezone_name: "Asia/Shanghai",
30716
+ support_h265: "1",
30717
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
30718
+ a_bogus: ""
30719
+ };
30720
+ const publishData = {
30721
+ item: {
30722
+ common: {
30723
+ text: params.title || "32234。sdsadadasda",
30724
+ text_extra: '[{"start":0,"end":5,"hashtag_id":0,"hashtag_name":"","type":7},{"start":5,"end":6,"hashtag_id":0,"hashtag_name":"","type":8}]',
30725
+ activity: "[]",
30726
+ challenges: "[]",
30727
+ hashtag_source: "",
30728
+ mentions: "[]",
30729
+ music_id: "",
30730
+ music_end_time: 0,
30731
+ hot_sentence: "",
30732
+ visibility_type: 0,
30733
+ download: 0,
30734
+ timing: -1,
30735
+ media_type: 2,
30736
+ images: []
30737
+ },
30738
+ cover: {
30739
+ poster: ""
30740
+ },
30741
+ mix: {},
30742
+ anchor: {
30743
+ poi_name: "",
30744
+ poi_id: "",
30745
+ anchor_content: "{}"
30746
+ },
30747
+ declare: {
30748
+ user_declare_info: "{}"
30749
+ }
30750
+ }
30751
+ };
30752
+ const aBogus = mock_sign_reply(publishParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30753
+ publishParams.a_bogus = aBogus;
30754
+ const queryString = new URLSearchParams(publishParams).toString();
30755
+ const args = [
30756
+ {
30757
+ headers
30758
+ },
30759
+ task.logger,
30760
+ params.proxyLoc,
30761
+ params.localIP,
30762
+ params.accountId
30763
+ ];
30764
+ const http = new Http({
30765
+ headers
30766
+ });
30767
+ const proxyHttp = new Http(...args);
30768
+ const uploadAuth = await proxyHttp.api({
30769
+ method: "get",
30770
+ url: `https://creator.douyin.com/web/api/media/upload/auth/v5/?${queryString}`,
30771
+ headers: {
30772
+ ...headers,
30773
+ "Content-Type": "application/json"
30774
+ }
30775
+ }, {
30776
+ retries: 3,
30777
+ retryDelay: 20,
30778
+ timeout: 3000
30779
+ });
30780
+ if (!uploadAuth.auth) {
30781
+ console.log("uploadAuth", JSON.stringify(uploadAuth));
30782
+ return {
30783
+ code: 414,
30784
+ message: uploadAuth.status_msg || "获取上传权限失败",
30785
+ data: ""
30786
+ };
30787
+ }
30788
+ async function GetUploadAddr(imgUrl, isCover) {
30789
+ const auth = JSON.parse(uploadAuth.auth);
30790
+ const times = new Date();
30791
+ const amzDate = times.toISOString().replace(/\.\d{3}Z$/, "Z").replace(/[:-]/g, "");
30792
+ const region = "cn-north-1";
30793
+ const service = "imagex";
30794
+ const sessionToken = auth.SessionToken;
30795
+ const accessKeyID = auth.AccessKeyID;
30796
+ const secretAccessKey = auth.SecretAccessKey;
30797
+ const addrParamsConfig = {
30798
+ accessKeyId: accessKeyID,
30799
+ secretAccessKey: secretAccessKey,
30800
+ sessionToken: sessionToken,
30801
+ region: region,
30802
+ service: service,
30803
+ method: "GET",
30804
+ pathname: "/",
30805
+ params: {
30806
+ Action: "ApplyImageUpload",
30807
+ ServiceId: "jm8ajry58r",
30808
+ Version: "2018-08-01",
30809
+ app_id: "2906",
30810
+ s: randomS(),
30811
+ user_id: ""
30812
+ }
30813
+ };
30814
+ const result = generateAuthorization(addrParamsConfig).authorization;
30815
+ const addrParamsQueryString = canonicalQueryString(addrParamsConfig.params);
30816
+ const uploadAddr = await proxyHttp.api({
30817
+ method: "get",
30818
+ url: `https://imagex.bytedanceapi.com/?${addrParamsQueryString}`,
30819
+ headers: {
30820
+ ...headers,
30821
+ Authorization: result,
30822
+ "Content-Type": "application/json",
30823
+ "X-amz-date": amzDate,
30824
+ "X-amz-security-token": sessionToken
30825
+ }
30826
+ }, {
30827
+ retries: 3,
30828
+ retryDelay: 20,
30829
+ timeout: 3000
30830
+ });
30831
+ if (!uploadAddr?.Result?.RequestId) return utils_response(500, "获取上传地址失败", "");
30832
+ const fileBuffer = external_node_fs_default().readFileSync(imgUrl);
30833
+ const uploadImgResp = await proxyHttp.api({
30834
+ method: "post",
30835
+ url: `https://tos-hl-x.snssdk.com/upload/v1/${uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri}`,
30836
+ headers: {
30837
+ ...headers,
30838
+ Authorization: uploadAddr.Result.UploadAddress.StoreInfos[0].Auth,
30839
+ "Content-crc32": calculateFileCrc32(imgUrl),
30840
+ "Content-Type": "application/octet-stream"
30841
+ },
30842
+ data: fileBuffer
30843
+ }, {
30844
+ retries: 3,
30845
+ retryDelay: 20,
30846
+ timeout: 3000
30847
+ });
30848
+ if (2000 === uploadImgResp.code) return isCover ? uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri : {
30849
+ uri: uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri,
30850
+ width: 1258,
30851
+ height: 1048
30852
+ };
30853
+ }
30854
+ if (params.coverImage) {
30855
+ const images = await Promise.all([
30856
+ params.coverImage
30857
+ ].map((url)=>{
30858
+ if (!url) throw new Error("封面图片 URL 不能为空");
30859
+ const fileName = getFilenameFromUrl(url);
30860
+ return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
30861
+ }));
30862
+ const coverUploadAddr = await GetUploadAddr(images[0], true);
30863
+ publishData.item.cover = {
30864
+ poster: coverUploadAddr
30865
+ };
30866
+ }
30867
+ if (params.banners) {
30868
+ const images = await Promise.all(params.banners.map((url)=>{
30869
+ if (!url) throw new Error("内容图片 URL 不能为空");
30870
+ const fileName = getFilenameFromUrl(url);
30871
+ return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
30872
+ }));
30873
+ const contentUploadAddr = await Promise.all(images.map((url)=>GetUploadAddr(url, false)));
30874
+ publishData.item.common.images = contentUploadAddr;
30875
+ }
30876
+ proxyHttp.addResponseInterceptor((response)=>{
30877
+ if (!response || !response.data) return;
30878
+ const responseData = response.data;
30879
+ if (response && responseData?.status_code && 0 !== responseData.status_code) return {
30880
+ code: responseData?.status_code,
30881
+ message: responseData.status_msg || "文章发布异常,请稍后重试。",
30882
+ data: responseData
30883
+ };
30884
+ });
30885
+ task._timerRecord.PrePublish = Date.now();
30886
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
30887
+ const publishQuery = {
30888
+ ...publishParams
30889
+ };
30890
+ publishQuery.a_bogus = mock_sign_reply(publishQuery, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
30891
+ const publishQueryParams = new URLSearchParams(publishQuery).toString();
30892
+ function generateRandomString(length) {
30893
+ const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
30894
+ let randomString = "";
30895
+ for(let i = 0; i < length; i++){
30896
+ const randomIndex = Math.floor(Math.random() * characters.length);
30897
+ randomString += characters.charAt(randomIndex);
30898
+ }
30899
+ return randomString;
30900
+ }
30901
+ publishData.item.common.creation_id = generateRandomString(8) + Date.now();
30902
+ const csrfToken = generateCsrfTokenAdvanced({
30903
+ cookies: params.cookies,
30904
+ url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
30905
+ method: "POST",
30906
+ userAgent: headers["user-agent"]
30907
+ });
30908
+ console.log("发布数据", JSON.stringify(publishData));
30909
+ const publishResult = await proxyHttp.api({
30910
+ method: "post",
30911
+ url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
30912
+ data: publishData,
30913
+ defaultErrorMsg: "发布异常,请稍后重试。",
30914
+ headers: {
30915
+ ...headers,
30916
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
30917
+ "Content-Type": "application/json",
30918
+ "Bd-ticket-guard-client-data": bdTicketGuardClientData,
30919
+ "Bd-ticket-guard-ree-public-key": ree_public_key,
30920
+ "Bd-ticket-guard-version": 2,
30921
+ "Bd-ticket-guard-web-sign-type": 1,
30922
+ "Bd-ticket-guard-web-version": 2,
30923
+ "X-secsdk-csrf-token": csrfToken,
30924
+ "X-tt-session-dtrait": params.cookies.find((e)=>"x-tt-session-dtrait" === e.name)?.value || ""
30925
+ }
30926
+ }, {
30927
+ retries: 2,
30928
+ retryDelay: 500,
30929
+ timeout: 12000
30930
+ });
30931
+ console.log("publishResult", publishResult);
30932
+ const isSuccess = 0 === publishResult.status_code;
30933
+ const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
30934
+ const data = isSuccess ? publishResult.item_id || "" : "";
30935
+ if (!isSuccess) {
30936
+ await updateTaskState?.({
30937
+ state: types_TaskState.FAILED,
30938
+ error: message
30939
+ });
30940
+ return {
30941
+ code: 414,
30942
+ data,
30943
+ message
30944
+ };
30945
+ }
30946
+ await updateTaskState?.({
30947
+ state: types_TaskState.SUCCESS,
30948
+ result: {
30949
+ response: data
30950
+ }
30951
+ });
30952
+ return utils_response(isSuccess ? 0 : 414, message, data);
30953
+ };
30954
+ const douyinPublish_rpa_rpaAction = async (task, params)=>{
30955
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
30956
+ const commonCookies = {
30957
+ path: "/",
30958
+ secure: true,
30959
+ domain: "douyin.com",
30960
+ url: "https://creator.douyin.com",
30961
+ httpOnly: true
30962
+ };
30963
+ const page = await task.createPage({
30964
+ show: task.debug,
30965
+ url: params.url || "https://creator.douyin.com/creator-micro/content/upload?default-tab=3",
30966
+ cookies: params.cookies?.map((it)=>({
30967
+ ...it,
30968
+ ...commonCookies
30969
+ }))
30970
+ });
30971
+ await updateTaskState?.({
30972
+ state: types_TaskState.ACTION,
30973
+ connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
30974
+ sessionId: task.sessionId
30975
+ });
30976
+ const tmpCachePath = task.getTmpPath();
30977
+ try {
30978
+ await page.waitForSelector("#micro", {
30979
+ state: "visible",
30980
+ timeout: 20000
30981
+ });
30982
+ } catch (error) {
30983
+ return {
30984
+ code: 414,
30985
+ message: "登录失效",
30986
+ data: page.url()
30987
+ };
30988
+ }
30989
+ const images = await Promise.all([
30990
+ "https://svip-8.rcouyi.com/file/draw/volc/2026/01/15/2011725723554811904.png"
30991
+ ].map((url)=>{
30992
+ const fileName = getFilenameFromUrl(url);
30993
+ return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
30994
+ }));
30995
+ const fileChooser = await page.waitForSelector('input[type="file"]', {
30996
+ timeout: 20000
30997
+ });
30998
+ if (fileChooser) await fileChooser.setInputFiles(images);
30999
+ const titleInstance = page.locator(".semi-input-wrapper input[placeholder='添加作品标题']");
31000
+ await titleInstance.waitFor({
31001
+ state: "visible",
31002
+ timeout: 50000
31003
+ });
31004
+ await titleInstance.click();
31005
+ await titleInstance.fill(params.title || "1111");
31006
+ await page.waitForTimeout(1000);
31007
+ const descInstance = page.locator("div[data-placeholder='添加作品描述...']");
31008
+ await descInstance.click();
31009
+ await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, "") || "22222");
31010
+ if ("2" === params.visibleRange) await page.locator("label:has-text('好友可见')").first().click();
31011
+ else if ("3" === params.visibleRange) await page.locator("label:has-text('仅自己可见')").first().click();
31012
+ if (!params.isImmediatelyPublish) {
31013
+ await await page.locator('label:has-text("定时发布")').first().click();
31014
+ await page.waitForTimeout(500);
31015
+ const releaseTimeInstance = page.locator(".semi-datepicker-input input[placeholder='日期和时间']");
31016
+ await releaseTimeInstance.click();
31017
+ await page.waitForTimeout(1000);
31018
+ await releaseTimeInstance.fill(params.scheduledPublish || "2026-02-01 15:30:30");
31019
+ await releaseTimeInstance.blur();
31020
+ }
31021
+ const response = await new Promise((resolve)=>{
31022
+ const handleResponse = async (response)=>{
31023
+ if (response.url().includes("/web/api/media/aweme/create_v2")) {
31024
+ console.log("匹配到发布接口响应");
31025
+ const jsonResponse = await response.json();
31026
+ console.log("发布接口响应数据:", jsonResponse);
31027
+ page.off("response", handleResponse);
31028
+ resolve(jsonResponse?.data?.item_id);
31029
+ }
31030
+ };
31031
+ console.log("监听响应事件");
31032
+ page.on("response", handleResponse);
31033
+ console.log("点击发布按钮");
31034
+ page.locator("#DCPF button:has-text('发布')").first().click();
31035
+ console.log("发布按钮已点击");
31036
+ });
31037
+ await updateTaskState?.({
31038
+ state: types_TaskState.SUCCESS,
31039
+ result: {
31040
+ response
31041
+ }
31042
+ });
31043
+ await page.close();
31044
+ return success(response);
31045
+ };
31046
+ const FictionalRendition = classic_schemas_object({
31047
+ type: literal("fictional-rendition")
31048
+ });
31049
+ const AIGenerated = classic_schemas_object({
31050
+ type: literal("ai-generated")
31051
+ });
31052
+ const SourceStatement = classic_schemas_object({
31053
+ type: literal("source-statement"),
31054
+ childType: classic_schemas_enum([
31055
+ "self-labeling",
31056
+ "self-shooting",
31057
+ "transshipment"
31058
+ ]),
31059
+ shootingLocation: classic_schemas_object({
31060
+ id: classic_schemas_string(),
31061
+ name: classic_schemas_string(),
31062
+ latitude: classic_schemas_number().optional(),
31063
+ longitude: classic_schemas_number().optional()
31064
+ }).optional(),
31065
+ shootingDate: classic_schemas_string().optional(),
31066
+ sourceMedia: classic_schemas_string().optional()
31067
+ });
31068
+ schemas_union([
31069
+ FictionalRendition,
31070
+ AIGenerated,
31071
+ SourceStatement
31072
+ ]);
31073
+ const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
31074
+ banners: classic_schemas_array(classic_schemas_string()),
31075
+ title: classic_schemas_string(),
31076
+ content: classic_schemas_string(),
31077
+ coverImage: classic_schemas_string().optional(),
31078
+ videoFile: classic_schemas_string().optional(),
31079
+ address: classic_schemas_object({
31080
+ id: classic_schemas_string(),
31081
+ name: classic_schemas_string(),
31082
+ latitude: classic_schemas_number().optional(),
31083
+ longitude: classic_schemas_number().optional()
31084
+ }).optional(),
31085
+ selfDeclaration: custom().optional(),
31086
+ topic: classic_schemas_array(classic_schemas_object({
31087
+ id: classic_schemas_string(),
31088
+ word: classic_schemas_string()
31089
+ })).optional(),
31090
+ proxyLoc: classic_schemas_string().optional(),
31091
+ localIP: classic_schemas_string().optional(),
31092
+ visibleRange: classic_schemas_enum([
31093
+ "1",
31094
+ "2",
31095
+ "3"
31096
+ ]).optional(),
31097
+ isImmediatelyPublish: classic_schemas_boolean().optional(),
31098
+ scheduledPublish: classic_schemas_string().optional(),
31099
+ isOriginal: classic_schemas_boolean().optional(),
31100
+ allowCoProduce: classic_schemas_boolean().optional(),
31101
+ allowCopy: classic_schemas_boolean().optional(),
31102
+ publishType: classic_schemas_enum([
31103
+ "1",
31104
+ "2",
31105
+ "3",
31106
+ "4"
31107
+ ]).optional(),
31108
+ publishAction: classic_schemas_enum([
31109
+ "publish",
31110
+ "draft"
31111
+ ]).optional(),
31112
+ isAiCoverImage: classic_schemas_boolean().optional(),
31113
+ summary: classic_schemas_string().optional()
31114
+ });
31115
+ const douyinPublish = async (task, params)=>{
31116
+ if ("rpa" === params.actionType) return douyinPublish_rpa_rpaAction(task, params);
31117
+ if ("mockApi" === params.actionType) return mock_mockAction(task, params);
31118
+ return executeAction(mock_mockAction, douyinPublish_rpa_rpaAction)(task, params);
31119
+ };
29459
31120
  const getBaijiahaoActivity = async (_task, params)=>{
29460
31121
  const cookies = params.cookies ?? [];
29461
31122
  const http = new Http({
@@ -31609,7 +33270,7 @@ var __webpack_exports__ = {};
31609
33270
  else if (message?.includes("资料审核")) error = errorList[2];
31610
33271
  return error || ("draft" === saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。");
31611
33272
  };
31612
- const mock_mockAction = async (task, params)=>{
33273
+ const toutiaoPublish_mock_mockAction = async (task, params)=>{
31613
33274
  const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
31614
33275
  const tmpCachePath = task.getTmpPath();
31615
33276
  const headers = {
@@ -32117,8 +33778,8 @@ var __webpack_exports__ = {};
32117
33778
  const toutiaoPublish = async (task, params)=>{
32118
33779
  params.content = formatSectionHtml(params.content);
32119
33780
  if ("rpa" === params.actionType) return toutiaoPublish_rpa_rpaAction(task, params);
32120
- if ("mockApi" === params.actionType) return mock_mockAction(task, params);
32121
- return executeAction(mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
33781
+ if ("mockApi" === params.actionType) return toutiaoPublish_mock_mockAction(task, params);
33782
+ return executeAction(toutiaoPublish_mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
32122
33783
  };
32123
33784
  const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
32124
33785
  const tmpCachePath = task.getTmpPath();
@@ -33625,7 +35286,7 @@ var __webpack_exports__ = {};
33625
35286
  share_page: "1",
33626
35287
  synctxweibo: "0",
33627
35288
  operation_seq,
33628
- req_id: randomString(32),
35289
+ req_id: dist_randomString(32),
33629
35290
  req_time: new Date().getTime() + 1e3 * client_time_diff,
33630
35291
  sync_version: "1",
33631
35292
  isFreePublish: params.masssend ? "false" : "true",
@@ -35914,13 +37575,13 @@ var __webpack_exports__ = {};
35914
37575
  });
35915
37576
  return success(data, message);
35916
37577
  };
35917
- const FictionalRendition = classic_schemas_object({
37578
+ const xiaohongshuPublish_FictionalRendition = classic_schemas_object({
35918
37579
  type: literal("fictional-rendition")
35919
37580
  });
35920
- const AIGenerated = classic_schemas_object({
37581
+ const xiaohongshuPublish_AIGenerated = classic_schemas_object({
35921
37582
  type: literal("ai-generated")
35922
37583
  });
35923
- const SourceStatement = classic_schemas_object({
37584
+ const xiaohongshuPublish_SourceStatement = classic_schemas_object({
35924
37585
  type: literal("source-statement"),
35925
37586
  childType: classic_schemas_enum([
35926
37587
  "self-labeling",
@@ -35932,9 +37593,9 @@ var __webpack_exports__ = {};
35932
37593
  sourceMedia: classic_schemas_string().optional()
35933
37594
  });
35934
37595
  schemas_union([
35935
- FictionalRendition,
35936
- AIGenerated,
35937
- SourceStatement
37596
+ xiaohongshuPublish_FictionalRendition,
37597
+ xiaohongshuPublish_AIGenerated,
37598
+ xiaohongshuPublish_SourceStatement
35938
37599
  ]);
35939
37600
  const XiaohongshuPublishParamsSchema = ActionCommonParamsSchema.extend({
35940
37601
  banners: classic_schemas_array(classic_schemas_string()),
@@ -36621,6 +38282,9 @@ var __webpack_exports__ = {};
36621
38282
  BjhSessionCheck(params) {
36622
38283
  return this.bindTask(BjhSessionCheck, params);
36623
38284
  }
38285
+ DySessionCheck(params) {
38286
+ return this.bindTask(DySessionCheck, params);
38287
+ }
36624
38288
  searchToutiaoTopicList(params) {
36625
38289
  return this.bindTask(searchToutiaoTopicList, params);
36626
38290
  }
@@ -36696,6 +38360,33 @@ var __webpack_exports__ = {};
36696
38360
  weixinPublish(params) {
36697
38361
  return this.bindTask(weixinPublish, params);
36698
38362
  }
38363
+ douyinPublish(params) {
38364
+ return this.bindTask(douyinPublish, params);
38365
+ }
38366
+ douyinGetTopics(params) {
38367
+ return this.bindTask(douyinGetTopics, params);
38368
+ }
38369
+ douyinGetMusicCategory(params) {
38370
+ return this.bindTask(douyinGetMusicCategory, params);
38371
+ }
38372
+ douyinGetMusicByCategory(params) {
38373
+ return this.bindTask(douyinGetMusicByCategory, params);
38374
+ }
38375
+ douyinGetMusic(params) {
38376
+ return this.bindTask(douyinGetMusic, params);
38377
+ }
38378
+ douyinGetLocation(params) {
38379
+ return this.bindTask(douyinGetLocation, params);
38380
+ }
38381
+ douyinGetHot(params) {
38382
+ return this.bindTask(douyinGetHot, params);
38383
+ }
38384
+ douyinGetCollection(params) {
38385
+ return this.bindTask(douyinGetCollection, params);
38386
+ }
38387
+ douyinLogin(params) {
38388
+ return this.bindTask(douyinLogin, params);
38389
+ }
36699
38390
  }
36700
38391
  })();
36701
38392
  var __webpack_export_target__ = exports;