@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/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_assert__ from "assert";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
2
4
  import * as __WEBPACK_EXTERNAL_MODULE_http__ from "http";
3
5
  import * as __WEBPACK_EXTERNAL_MODULE_https__ from "https";
4
6
  import * as __WEBPACK_EXTERNAL_MODULE_net__ from "net";
@@ -1738,6 +1740,638 @@ var __webpack_modules__ = {
1738
1740
  }
1739
1741
  module.exports = GenXSCommon;
1740
1742
  },
1743
+ "./src/utils/douyin/csrfToken.js": function(module, __unused_webpack_exports, __webpack_require__) {
1744
+ const crypto = __webpack_require__("crypto");
1745
+ function generateCsrfToken(options = {}) {
1746
+ const { cookies = [], url = '', method = 'POST' } = options;
1747
+ const sessionid = getCookieValue(cookies, 'sessionid') || '';
1748
+ const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
1749
+ const msToken = getCookieValue(cookies, 'msToken') || '';
1750
+ const ttwid = getCookieValue(cookies, 'ttwid') || '';
1751
+ const timestamp = Math.floor(Date.now() / 1000);
1752
+ const version = '0000';
1753
+ const timestampHex = timestamp.toString(16).padStart(8, '0');
1754
+ const random = generateRandomHex(8);
1755
+ const signData = `${method}${url}${sessionid}${uid_tt}${msToken}${ttwid}${timestamp}`;
1756
+ const hash = crypto.createHash('md5').update(signData).digest('hex');
1757
+ const csrfToken = `0001${version}${timestampHex}${random}${hash}`;
1758
+ return csrfToken;
1759
+ }
1760
+ function getCookieValue(cookies, name) {
1761
+ const cookie = cookies.find((c)=>c.name === name);
1762
+ return cookie ? cookie.value : '';
1763
+ }
1764
+ function generateRandomHex(length) {
1765
+ const bytes = crypto.randomBytes(Math.ceil(length / 2));
1766
+ return bytes.toString('hex').slice(0, length);
1767
+ }
1768
+ function generateCsrfTokenAdvanced(options = {}) {
1769
+ const { cookies = [], url = '', method = 'POST', userAgent = '' } = options;
1770
+ const sessionid = getCookieValue(cookies, 'sessionid') || '';
1771
+ const sid_guard = getCookieValue(cookies, 'sid_guard') || '';
1772
+ const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
1773
+ const msToken = getCookieValue(cookies, 'msToken') || '';
1774
+ const ttwid = getCookieValue(cookies, 'ttwid') || '';
1775
+ const odin_tt = getCookieValue(cookies, 'odin_tt') || '';
1776
+ const timestamp = Date.now();
1777
+ const timestampSec = Math.floor(timestamp / 1000);
1778
+ let pathname = '';
1779
+ try {
1780
+ const urlObj = new URL(url, 'https://creator.douyin.com');
1781
+ pathname = urlObj.pathname;
1782
+ } catch (e) {
1783
+ pathname = url;
1784
+ }
1785
+ const signParts = [
1786
+ method.toUpperCase(),
1787
+ pathname,
1788
+ timestampSec,
1789
+ sessionid,
1790
+ sid_guard,
1791
+ uid_tt,
1792
+ msToken,
1793
+ ttwid,
1794
+ odin_tt,
1795
+ userAgent
1796
+ ].filter(Boolean);
1797
+ const signData = signParts.join('|');
1798
+ const firstHash = crypto.createHash('md5').update(signData).digest('hex');
1799
+ const secondHash = crypto.createHash('md5').update(firstHash + timestamp).digest('hex');
1800
+ const timestampHex = timestampSec.toString(16).padStart(8, '0');
1801
+ const random = generateRandomHex(16);
1802
+ return `0001000${timestampHex.slice(0, 2)}${random}${secondHash}`;
1803
+ }
1804
+ function generateCsrfTokenSimple(cookies = []) {
1805
+ const sessionid = getCookieValue(cookies, 'sessionid') || 'default_session';
1806
+ const timestamp = Math.floor(Date.now() / 1000);
1807
+ const random = generateRandomHex(32);
1808
+ const hash = crypto.createHash('md5').update(`${sessionid}${timestamp}${random}`).digest('hex');
1809
+ const timestampHex = timestamp.toString(16).padStart(8, '0');
1810
+ return `0001000${timestampHex}${random}${hash}`.slice(0, 90);
1811
+ }
1812
+ function parseCsrfToken(token) {
1813
+ if (!token || token.length < 20) return null;
1814
+ try {
1815
+ const prefix = token.slice(0, 4);
1816
+ const version = token.slice(4, 8);
1817
+ const timestampHex = token.slice(8, 16);
1818
+ const timestamp = parseInt(timestampHex, 16);
1819
+ const date = new Date(1000 * timestamp);
1820
+ return {
1821
+ prefix,
1822
+ version,
1823
+ timestamp,
1824
+ date: date.toISOString(),
1825
+ isValid: '0001' === prefix
1826
+ };
1827
+ } catch (e) {
1828
+ return null;
1829
+ }
1830
+ }
1831
+ module.exports = {
1832
+ generateCsrfToken,
1833
+ generateCsrfTokenAdvanced,
1834
+ generateCsrfTokenSimple,
1835
+ parseCsrfToken
1836
+ };
1837
+ },
1838
+ "./src/utils/douyin/douyin.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1839
+ __webpack_require__.r(__webpack_exports__);
1840
+ __webpack_require__.d(__webpack_exports__, {
1841
+ sign_datail: ()=>sign_datail,
1842
+ sign_reply: ()=>sign_reply
1843
+ });
1844
+ function rc4_encrypt(plaintext, key) {
1845
+ var s = [];
1846
+ for(var i = 0; i < 256; i++)s[i] = i;
1847
+ var j = 0;
1848
+ for(var i = 0; i < 256; i++){
1849
+ j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
1850
+ var temp = s[i];
1851
+ s[i] = s[j];
1852
+ s[j] = temp;
1853
+ }
1854
+ var i = 0;
1855
+ var j = 0;
1856
+ var cipher = [];
1857
+ for(var k = 0; k < plaintext.length; k++){
1858
+ i = (i + 1) % 256;
1859
+ j = (j + s[i]) % 256;
1860
+ var temp = s[i];
1861
+ s[i] = s[j];
1862
+ s[j] = temp;
1863
+ var t = (s[i] + s[j]) % 256;
1864
+ cipher.push(String.fromCharCode(s[t] ^ plaintext.charCodeAt(k)));
1865
+ }
1866
+ return cipher.join('');
1867
+ }
1868
+ function le(e, r) {
1869
+ return (e << (r %= 32) | e >>> 32 - r) >>> 0;
1870
+ }
1871
+ function de(e) {
1872
+ return 0 <= e && e < 16 ? 2043430169 : 16 <= e && e < 64 ? 2055708042 : void console['error']("invalid j for constant Tj");
1873
+ }
1874
+ function pe(e, r, t, n) {
1875
+ 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);
1876
+ }
1877
+ function he(e, r, t, n) {
1878
+ 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);
1879
+ }
1880
+ function reset() {
1881
+ 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;
1882
+ }
1883
+ function write(e) {
1884
+ var a = "string" == typeof e ? function(e) {
1885
+ var n = encodeURIComponent(e)['replace'](/%([0-9A-F]{2})/g, function(e, r) {
1886
+ return String['fromCharCode']("0x" + r);
1887
+ }), a = new Array(n['length']);
1888
+ return Array['prototype']['forEach']['call'](n, function(e, r) {
1889
+ a[r] = e.charCodeAt(0);
1890
+ }), a;
1891
+ }(e) : e;
1892
+ this.size += a.length;
1893
+ var f = 64 - this['chunk']['length'];
1894
+ if (a['length'] < f) this['chunk'] = this['chunk'].concat(a);
1895
+ 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;
1896
+ }
1897
+ function sum(e, t) {
1898
+ e && (this['reset'](), this['write'](e)), this['_fill']();
1899
+ for(var f = 0; f < this.chunk['length']; f += 64)this._compress(this['chunk']['slice'](f, f + 64));
1900
+ var i = null;
1901
+ if ('hex' == t) {
1902
+ i = "";
1903
+ for(f = 0; f < 8; f++)i += se(this['reg'][f]['toString'](16), 8, "0");
1904
+ } else for(i = new Array(32), f = 0; f < 8; f++){
1905
+ var c = this.reg[f];
1906
+ 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;
1907
+ }
1908
+ return this['reset'](), i;
1909
+ }
1910
+ function _compress(t) {
1911
+ if (t < 64) console.error("compress error: not enough data");
1912
+ else {
1913
+ for(var f = function(e) {
1914
+ 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;
1915
+ for(var n = 16; n < 68; n++){
1916
+ var a = r[n - 16] ^ r[n - 9] ^ le(r[n - 3], 15);
1917
+ a = a ^ le(a, 15) ^ le(a, 23), r[n] = (a ^ le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
1918
+ }
1919
+ for(n = 0; n < 64; n++)r[n + 68] = (r[n] ^ r[n + 4]) >>> 0;
1920
+ return r;
1921
+ }(t), i = this['reg'].slice(0), c = 0; c < 64; c++){
1922
+ 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]);
1923
+ u = (4294967295 & (u = u + i[3] + s + f[c + 68])) >>> 0;
1924
+ var b = he(c, i[4], i[5], i[6]);
1925
+ 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;
1926
+ }
1927
+ for(var l = 0; l < 8; l++)this['reg'][l] = (this['reg'][l] ^ i[l]) >>> 0;
1928
+ }
1929
+ }
1930
+ function _fill() {
1931
+ var a = 8 * this['size'], f = this['chunk']['push'](128) % 64;
1932
+ for(64 - f < 8 && (f -= 64); f < 56; f++)this.chunk['push'](0);
1933
+ for(var i = 0; i < 4; i++){
1934
+ var c = Math['floor'](a / 4294967296);
1935
+ this['chunk'].push(c >>> 8 * (3 - i) & 255);
1936
+ }
1937
+ for(i = 0; i < 4; i++)this['chunk']['push'](a >>> 8 * (3 - i) & 255);
1938
+ }
1939
+ function SM3() {
1940
+ this.reg = [];
1941
+ this.chunk = [];
1942
+ this.size = 0;
1943
+ this.reset();
1944
+ }
1945
+ SM3.prototype.reset = reset;
1946
+ SM3.prototype.write = write;
1947
+ SM3.prototype.sum = sum;
1948
+ SM3.prototype._compress = _compress;
1949
+ SM3.prototype._fill = _fill;
1950
+ function result_encrypt(long_str, num = null) {
1951
+ let s_obj = {
1952
+ s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
1953
+ s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
1954
+ s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
1955
+ s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
1956
+ s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
1957
+ };
1958
+ let constant = {
1959
+ 0: 16515072,
1960
+ 1: 258048,
1961
+ 2: 4032,
1962
+ str: s_obj[num]
1963
+ };
1964
+ let result = "";
1965
+ let lound = 0;
1966
+ let long_int = get_long_int(lound, long_str);
1967
+ for(let i = 0; i < long_str.length / 3 * 4; i++){
1968
+ if (Math.floor(i / 4) !== lound) {
1969
+ lound += 1;
1970
+ long_int = get_long_int(lound, long_str);
1971
+ }
1972
+ let key = i % 4;
1973
+ let temp_int = 0;
1974
+ switch(key){
1975
+ case 0:
1976
+ temp_int = (long_int & constant["0"]) >> 18;
1977
+ result += constant["str"].charAt(temp_int);
1978
+ break;
1979
+ case 1:
1980
+ temp_int = (long_int & constant["1"]) >> 12;
1981
+ result += constant["str"].charAt(temp_int);
1982
+ break;
1983
+ case 2:
1984
+ temp_int = (long_int & constant["2"]) >> 6;
1985
+ result += constant["str"].charAt(temp_int);
1986
+ break;
1987
+ case 3:
1988
+ temp_int = 63 & long_int;
1989
+ result += constant["str"].charAt(temp_int);
1990
+ break;
1991
+ default:
1992
+ break;
1993
+ }
1994
+ }
1995
+ return result;
1996
+ }
1997
+ function get_long_int(round, long_str) {
1998
+ round *= 3;
1999
+ return long_str.charCodeAt(round) << 16 | long_str.charCodeAt(round + 1) << 8 | long_str.charCodeAt(round + 2);
2000
+ }
2001
+ function gener_random(random, option) {
2002
+ return [
2003
+ 170 & random | 85 & option[0],
2004
+ 85 & random | 170 & option[0],
2005
+ random >> 8 & 170 | 85 & option[1],
2006
+ random >> 8 & 85 | 170 & option[1]
2007
+ ];
2008
+ }
2009
+ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suffix = "cus", Arguments = [
2010
+ 0,
2011
+ 1,
2012
+ 14
2013
+ ]) {
2014
+ let sm3 = new SM3();
2015
+ let start_time = Date.now();
2016
+ let url_search_params_list = sm3.sum(sm3.sum(url_search_params + suffix));
2017
+ let cus = sm3.sum(sm3.sum(suffix));
2018
+ let ua = sm3.sum(result_encrypt(rc4_encrypt(user_agent, String.fromCharCode.apply(null, [
2019
+ 0.00390625,
2020
+ 1,
2021
+ Arguments[2]
2022
+ ])), "s3"));
2023
+ let end_time = Date.now();
2024
+ let b = {
2025
+ 8: 3,
2026
+ 10: end_time,
2027
+ 15: {
2028
+ aid: 6383,
2029
+ pageId: 6241,
2030
+ boe: false,
2031
+ ddrt: 7,
2032
+ paths: {
2033
+ include: [
2034
+ {},
2035
+ {},
2036
+ {},
2037
+ {},
2038
+ {},
2039
+ {},
2040
+ {}
2041
+ ],
2042
+ exclude: []
2043
+ },
2044
+ track: {
2045
+ mode: 0,
2046
+ delay: 300,
2047
+ paths: []
2048
+ },
2049
+ dump: true,
2050
+ rpU: ""
2051
+ },
2052
+ 16: start_time,
2053
+ 18: 44,
2054
+ 19: [
2055
+ 1,
2056
+ 0,
2057
+ 1,
2058
+ 5
2059
+ ]
2060
+ };
2061
+ b[20] = b[16] >> 24 & 255;
2062
+ b[21] = b[16] >> 16 & 255;
2063
+ b[22] = b[16] >> 8 & 255;
2064
+ b[23] = 255 & b[16];
2065
+ b[24] = b[16] / 256 / 256 / 256 / 256 >> 0;
2066
+ b[25] = b[16] / 256 / 256 / 256 / 256 / 256 >> 0;
2067
+ b[26] = Arguments[0] >> 24 & 255;
2068
+ b[27] = Arguments[0] >> 16 & 255;
2069
+ b[28] = Arguments[0] >> 8 & 255;
2070
+ b[29] = 255 & Arguments[0];
2071
+ b[30] = Arguments[1] / 256 & 255;
2072
+ b[31] = Arguments[1] % 256 & 255;
2073
+ b[32] = Arguments[1] >> 24 & 255;
2074
+ b[33] = Arguments[1] >> 16 & 255;
2075
+ b[34] = Arguments[2] >> 24 & 255;
2076
+ b[35] = Arguments[2] >> 16 & 255;
2077
+ b[36] = Arguments[2] >> 8 & 255;
2078
+ b[37] = 255 & Arguments[2];
2079
+ b[38] = url_search_params_list[21];
2080
+ b[39] = url_search_params_list[22];
2081
+ b[40] = cus[21];
2082
+ b[41] = cus[22];
2083
+ b[42] = ua[23];
2084
+ b[43] = ua[24];
2085
+ b[44] = b[10] >> 24 & 255;
2086
+ b[45] = b[10] >> 16 & 255;
2087
+ b[46] = b[10] >> 8 & 255;
2088
+ b[47] = 255 & b[10];
2089
+ b[48] = b[8];
2090
+ b[49] = b[10] / 256 / 256 / 256 / 256 >> 0;
2091
+ b[50] = b[10] / 256 / 256 / 256 / 256 / 256 >> 0;
2092
+ b[51] = b[15]['pageId'];
2093
+ b[52] = b[15]['pageId'] >> 24 & 255;
2094
+ b[53] = b[15]['pageId'] >> 16 & 255;
2095
+ b[54] = b[15]['pageId'] >> 8 & 255;
2096
+ b[55] = 255 & b[15]['pageId'];
2097
+ b[56] = b[15]['aid'];
2098
+ b[57] = 255 & b[15]['aid'];
2099
+ b[58] = b[15]['aid'] >> 8 & 255;
2100
+ b[59] = b[15]['aid'] >> 16 & 255;
2101
+ b[60] = b[15]['aid'] >> 24 & 255;
2102
+ let window_env_list = [];
2103
+ for(let index = 0; index < window_env_str.length; index++)window_env_list.push(window_env_str.charCodeAt(index));
2104
+ b[64] = window_env_list.length;
2105
+ b[65] = 255 & b[64];
2106
+ b[66] = b[64] >> 8 & 255;
2107
+ b[69] = 0;
2108
+ b[70] = 255 & b[69];
2109
+ b[71] = b[69] >> 8 & 255;
2110
+ 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];
2111
+ let bb = [
2112
+ b[18],
2113
+ b[20],
2114
+ b[52],
2115
+ b[26],
2116
+ b[30],
2117
+ b[34],
2118
+ b[58],
2119
+ b[38],
2120
+ b[40],
2121
+ b[53],
2122
+ b[42],
2123
+ b[21],
2124
+ b[27],
2125
+ b[54],
2126
+ b[55],
2127
+ b[31],
2128
+ b[35],
2129
+ b[57],
2130
+ b[39],
2131
+ b[41],
2132
+ b[43],
2133
+ b[22],
2134
+ b[28],
2135
+ b[32],
2136
+ b[60],
2137
+ b[36],
2138
+ b[23],
2139
+ b[29],
2140
+ b[33],
2141
+ b[37],
2142
+ b[44],
2143
+ b[45],
2144
+ b[59],
2145
+ b[46],
2146
+ b[47],
2147
+ b[48],
2148
+ b[49],
2149
+ b[50],
2150
+ b[24],
2151
+ b[25],
2152
+ b[65],
2153
+ b[66],
2154
+ b[70],
2155
+ b[71]
2156
+ ];
2157
+ bb = bb.concat(window_env_list).concat(b[72]);
2158
+ return rc4_encrypt(String.fromCharCode.apply(null, bb), String.fromCharCode.apply(null, [
2159
+ 121
2160
+ ]));
2161
+ }
2162
+ function generate_random_str() {
2163
+ let random_str_list = [];
2164
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
2165
+ 3,
2166
+ 45
2167
+ ]));
2168
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
2169
+ 1,
2170
+ 0
2171
+ ]));
2172
+ random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
2173
+ 1,
2174
+ 5
2175
+ ]));
2176
+ return String.fromCharCode.apply(null, random_str_list);
2177
+ }
2178
+ function sign(url_search_params, user_agent, arr) {
2179
+ 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);
2180
+ return result_encrypt(result_str, "s4") + "=";
2181
+ }
2182
+ function sign_datail(params, userAgent) {
2183
+ return sign(params, userAgent, [
2184
+ 0,
2185
+ 1,
2186
+ 14
2187
+ ]);
2188
+ }
2189
+ function sign_reply(params, userAgent) {
2190
+ return sign(params, userAgent, [
2191
+ 0,
2192
+ 1,
2193
+ 8
2194
+ ]);
2195
+ }
2196
+ },
2197
+ "./src/utils/douyin/douyinSign.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2198
+ __webpack_require__.r(__webpack_exports__);
2199
+ __webpack_require__.d(__webpack_exports__, {
2200
+ calculateFileCrc32: ()=>calculateFileCrc32,
2201
+ canonicalQueryString: ()=>canonicalQueryString,
2202
+ generateAuthorization: ()=>generateAuthorization,
2203
+ randomS: ()=>randomS
2204
+ });
2205
+ const crypto = __webpack_require__("crypto");
2206
+ const UNSIGNABLE_HEADERS = [
2207
+ 'authorization',
2208
+ 'content-type',
2209
+ 'content-length',
2210
+ 'user-agent',
2211
+ 'presigned-expires',
2212
+ 'expect',
2213
+ 'x-amzn-trace-id'
2214
+ ];
2215
+ function sha256(data) {
2216
+ return crypto.createHash('sha256').update(data, 'utf8').digest('hex');
2217
+ }
2218
+ function hmac(key, data) {
2219
+ return crypto.createHmac('sha256', key).update(data, 'utf8').digest();
2220
+ }
2221
+ function getSigningKey(secretAccessKey, dateStamp, region, service) {
2222
+ const kDate = hmac('AWS4' + secretAccessKey, dateStamp);
2223
+ const kRegion = hmac(kDate, region);
2224
+ const kService = hmac(kRegion, service);
2225
+ const kSigning = hmac(kService, 'aws4_request');
2226
+ return kSigning;
2227
+ }
2228
+ function isSignableHeader(header) {
2229
+ const lowerHeader = header.toLowerCase();
2230
+ return lowerHeader.startsWith('x-amz-') || !UNSIGNABLE_HEADERS.includes(lowerHeader);
2231
+ }
2232
+ function canonicalHeaderValues(value) {
2233
+ return value.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
2234
+ }
2235
+ function canonicalHeaders(headers) {
2236
+ const headerPairs = [];
2237
+ Object.keys(headers).forEach((key)=>{
2238
+ headerPairs.push([
2239
+ key,
2240
+ headers[key]
2241
+ ]);
2242
+ });
2243
+ headerPairs.sort((a, b)=>a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1);
2244
+ const result = [];
2245
+ headerPairs.forEach(([key, value])=>{
2246
+ const lowerKey = key.toLowerCase();
2247
+ if (isSignableHeader(lowerKey)) result.push(`${lowerKey}:${canonicalHeaderValues(value.toString())}`);
2248
+ });
2249
+ return result.join('\n');
2250
+ }
2251
+ function signedHeaders(headers) {
2252
+ const headerNames = [];
2253
+ Object.keys(headers).forEach((key)=>{
2254
+ const lowerKey = key.toLowerCase();
2255
+ if (isSignableHeader(lowerKey)) headerNames.push(lowerKey);
2256
+ });
2257
+ return headerNames.sort().join(';');
2258
+ }
2259
+ function canonicalQueryString(params) {
2260
+ if (!params || 0 === Object.keys(params).length) return '';
2261
+ return Object.keys(params).sort().map((key)=>{
2262
+ const value = params[key];
2263
+ return encodeURIComponent(key) + '=' + encodeURIComponent(String(value));
2264
+ }).join('&');
2265
+ }
2266
+ function iso8601(date) {
2267
+ return date.toISOString().replace(/\.\d{3}Z$/, 'Z');
2268
+ }
2269
+ function randomS() {
2270
+ const pool = '0123456789abcdefghijklmnopqrstuvwxyz';
2271
+ let s = '';
2272
+ for(let i = 0; i < 11; i++)s += pool.charAt(Math.floor(Math.random() * pool.length));
2273
+ return s;
2274
+ }
2275
+ function generateAuthorization(config) {
2276
+ const { accessKeyId, secretAccessKey, sessionToken, region, service, method = 'GET', pathname = '/', params = {}, body = '', headers = {} } = config;
2277
+ const now = new Date();
2278
+ const amzDate = iso8601(now).replace(/[:\-]|\.\d{3}/g, '');
2279
+ const dateStamp = amzDate.substr(0, 8);
2280
+ const requestHeaders = {
2281
+ ...headers,
2282
+ 'X-Amz-Date': amzDate
2283
+ };
2284
+ if (sessionToken) requestHeaders['x-amz-security-token'] = sessionToken;
2285
+ if (body) requestHeaders['X-Amz-Content-Sha256'] = sha256(JSON.stringify(body));
2286
+ const canonicalQueryStr = canonicalQueryString(params);
2287
+ const canonicalHeadersStr = canonicalHeaders(requestHeaders);
2288
+ const signedHeadersStr = signedHeaders(requestHeaders);
2289
+ const payloadHash = body ? sha256(JSON.stringify(body)) : sha256('');
2290
+ const canonicalRequest = [
2291
+ method.toUpperCase(),
2292
+ pathname,
2293
+ canonicalQueryStr,
2294
+ canonicalHeadersStr + '\n',
2295
+ signedHeadersStr,
2296
+ payloadHash
2297
+ ].join('\n');
2298
+ const algorithm = 'AWS4-HMAC-SHA256';
2299
+ const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
2300
+ const canonicalRequestHash = sha256(canonicalRequest);
2301
+ const stringToSign = [
2302
+ algorithm,
2303
+ amzDate,
2304
+ credentialScope,
2305
+ canonicalRequestHash
2306
+ ].join('\n');
2307
+ const signingKey = getSigningKey(secretAccessKey, dateStamp, region, service);
2308
+ const signature = crypto.createHmac('sha256', signingKey).update(stringToSign, 'utf8').digest('hex');
2309
+ const authorization = `${algorithm} Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeadersStr}, Signature=${signature}`;
2310
+ return {
2311
+ authorization,
2312
+ headers: requestHeaders,
2313
+ amzDate
2314
+ };
2315
+ }
2316
+ const fs = __webpack_require__("fs");
2317
+ function calculateFileCrc32(filePath) {
2318
+ const data = fs.readFileSync(filePath);
2319
+ const crc32Value = crc32(data);
2320
+ const crc32Hex = crc32Value.toString(16);
2321
+ return crc32Hex;
2322
+ }
2323
+ function crc32(data) {
2324
+ const CRC_TABLE = [];
2325
+ for(let i = 0; i < 256; i++){
2326
+ let crc = i;
2327
+ for(let j = 0; j < 8; j++)crc = 1 & crc ? 0xEDB88320 ^ crc >>> 1 : crc >>> 1;
2328
+ CRC_TABLE.push(crc >>> 0);
2329
+ }
2330
+ let crc = 0xFFFFFFFF;
2331
+ for(let i = 0; i < data.length; i++){
2332
+ const byte = data[i];
2333
+ const index = (crc ^ byte) & 0xFF;
2334
+ crc = (CRC_TABLE[index] ^ crc >>> 8) >>> 0;
2335
+ }
2336
+ crc = (0xFFFFFFFF ^ crc) >>> 0;
2337
+ return crc;
2338
+ }
2339
+ },
2340
+ "./src/utils/douyin/reqSign.js.js": function(module, __unused_webpack_exports, __webpack_require__) {
2341
+ const crypto = __webpack_require__("crypto");
2342
+ function bufferToHex(buffer) {
2343
+ return buffer.toString('hex');
2344
+ }
2345
+ function generateReqSign(privateKeyPem, data) {
2346
+ try {
2347
+ const privateKey = crypto.createPrivateKey({
2348
+ key: privateKeyPem,
2349
+ format: 'pem',
2350
+ type: 'pkcs8'
2351
+ });
2352
+ const dataBuffer = Buffer.from(data, 'utf8');
2353
+ const signature = crypto.sign('sha256', dataBuffer, {
2354
+ key: privateKey,
2355
+ dsaEncoding: 'der'
2356
+ });
2357
+ return bufferToHex(signature);
2358
+ } catch (error) {
2359
+ console.error('req_sign 生成失败:', error);
2360
+ throw error;
2361
+ }
2362
+ }
2363
+ function generateReqSignFromTicket(ticket, privateKeyPem) {
2364
+ return generateReqSign(privateKeyPem, ticket);
2365
+ }
2366
+ function generateReqSignFromSignData(signData, privateKeyPem) {
2367
+ return generateReqSign(privateKeyPem, signData);
2368
+ }
2369
+ module.exports = {
2370
+ generateReqSign,
2371
+ generateReqSignFromTicket,
2372
+ generateReqSignFromSignData
2373
+ };
2374
+ },
1741
2375
  "./src/utils/ttABEncrypt.js": function(module, __unused_webpack_exports, __webpack_require__) {
1742
2376
  module = __webpack_require__.nmd(module);
1743
2377
  const a0_0x45db08 = a0_0x4b0d;
@@ -4238,6 +4872,12 @@ var __webpack_modules__ = {
4238
4872
  assert: function(module) {
4239
4873
  module.exports = __WEBPACK_EXTERNAL_MODULE_assert__;
4240
4874
  },
4875
+ crypto: function(module) {
4876
+ module.exports = __WEBPACK_EXTERNAL_MODULE_crypto__;
4877
+ },
4878
+ fs: function(module) {
4879
+ module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
4880
+ },
4241
4881
  http: function(module) {
4242
4882
  module.exports = __WEBPACK_EXTERNAL_MODULE_http__;
4243
4883
  },
@@ -4276,6 +4916,29 @@ function __webpack_require__(moduleId) {
4276
4916
  module.loaded = true;
4277
4917
  return module.exports;
4278
4918
  }
4919
+ (()=>{
4920
+ __webpack_require__.d = function(exports, definition) {
4921
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
4922
+ enumerable: true,
4923
+ get: definition[key]
4924
+ });
4925
+ };
4926
+ })();
4927
+ (()=>{
4928
+ __webpack_require__.o = function(obj, prop) {
4929
+ return Object.prototype.hasOwnProperty.call(obj, prop);
4930
+ };
4931
+ })();
4932
+ (()=>{
4933
+ __webpack_require__.r = function(exports) {
4934
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
4935
+ value: 'Module'
4936
+ });
4937
+ Object.defineProperty(exports, '__esModule', {
4938
+ value: true
4939
+ });
4940
+ };
4941
+ })();
4279
4942
  (()=>{
4280
4943
  __webpack_require__.nmd = function(module) {
4281
4944
  module.paths = [];
@@ -4283,7 +4946,7 @@ function __webpack_require__(moduleId) {
4283
4946
  return module;
4284
4947
  };
4285
4948
  })();
4286
- var package_namespaceObject = JSON.parse('{"i8":"1.2.32-beta.0"}');
4949
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.1"}');
4287
4950
  var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
4288
4951
  async function ProxyAgent(ip, adr, accountId, refresh) {
4289
4952
  const http = new Http({
@@ -10452,92 +11115,620 @@ const BjhSessionCheck = async (_task, params)=>{
10452
11115
  };
10453
11116
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, message);
10454
11117
  };
10455
- const douyinLogin_rpa_server_scanRetryMaxCount = 60;
10456
- const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
10457
- const rpa_server_rpaServer = async (task, params)=>{
10458
- const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
10459
- let executionState;
10460
- let proxyUrl;
10461
- if (params.localIP) {
10462
- const args = [
10463
- params.localIP,
10464
- params.proxyLoc,
10465
- params.accountId
10466
- ];
10467
- task.logger?.info(`==> 开始获取代理信息:${args}`);
10468
- const ProxyAgentWithLogger = ProxyAgent.bind({
10469
- logger: task.logger
10470
- });
10471
- const ProxyAgentResult = await ProxyAgentWithLogger(...args);
10472
- task.logger?.info("==> 代理信息获取成功!");
10473
- proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
10474
- }
10475
- const page = await task.createPage({
10476
- url: "https://creator.douyin.com/",
10477
- proxyUrl,
10478
- userAgent: params.userAgent,
10479
- ...params.viewport ? {
10480
- viewport: params.viewport
10481
- } : {}
10482
- });
10483
- await page.route("**/*.mp4", (route)=>route.abort());
10484
- await page.route("**/*.png", (route)=>route.abort());
10485
- await page.route("**/*.ttf", (route)=>route.abort());
10486
- await page.addInitScript(()=>{
10487
- window.requestAnimationFrame = ()=>0;
10488
- });
10489
- task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
10490
- await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
10491
- timeout: 15000
10492
- });
10493
- await page.waitForLoadState("networkidle");
10494
- await page.goto("about:blank");
10495
- await page.goBack({
10496
- waitUntil: "domcontentloaded"
11118
+ const DySessionCheck = async (_task, params)=>{
11119
+ const http = new Http({
11120
+ headers: {
11121
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11122
+ referer: "https://creator.douyin.com/",
11123
+ "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"
11124
+ }
10497
11125
  });
10498
- task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
10499
- await page.locator(".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle").click();
10500
- task.steelBrowser?.on("disconnected", async ()=>{
10501
- const browserContext = task.steelBrowserContext;
10502
- const browser = task.steelBrowser;
10503
- executionState = types_ExecutionState.BROWSER_CLOSED;
10504
- await page.close();
10505
- if (browserContext) await browserContext.close();
10506
- if (browser) await browser.close();
11126
+ const res = await http.api({
11127
+ method: "get",
11128
+ url: "https://creator.douyin.com/aweme/v1/creator/user/info/",
11129
+ params: {
11130
+ _ts: Date.now()
11131
+ },
11132
+ defaultErrorMsg: "抖音登录状态失效。"
10507
11133
  });
10508
- await updateTaskState?.({
10509
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.WAIT_SCAN,
10510
- connectAddress: await task.steelConnector?.getLive(task.sessionId || ""),
10511
- sessionId: task.sessionId
11134
+ const isSuccess = 0 === res.status_code;
11135
+ const message = "抖音账号有效性检测成功";
11136
+ const data = isSuccess ? {
11137
+ isValidSession: true
11138
+ } : {
11139
+ isValidSession: false
11140
+ };
11141
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, message);
11142
+ };
11143
+ const DouyinGetCollectionParamsSchema = ActionCommonParamsSchema.extend({
11144
+ keyword: schemas_string().optional(),
11145
+ count: schemas_number().optional()
11146
+ });
11147
+ const { sign_datail, sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11148
+ const douyinGetCollection = async (_task, params)=>{
11149
+ const headers = {
11150
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11151
+ referer: "https://creator.douyin.com/",
11152
+ origin: "https://creator.douyin.com/"
11153
+ };
11154
+ const args = [
11155
+ {
11156
+ headers
11157
+ },
11158
+ _task.logger,
11159
+ params.proxyLoc,
11160
+ params.localIP,
11161
+ params.accountId
11162
+ ];
11163
+ const http = new Http(...args);
11164
+ const collectionParams = {
11165
+ status: "0,2",
11166
+ count: "50",
11167
+ cursor: "0",
11168
+ source: "collection_create",
11169
+ aid: "1128",
11170
+ cookie_enabled: "true",
11171
+ screen_width: "1920",
11172
+ screen_height: "1200",
11173
+ browser_language: "zh-CN",
11174
+ browser_platform: "Win32",
11175
+ browser_name: "Mozilla",
11176
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11177
+ browser_online: "true",
11178
+ timezone_name: "Asia/Shanghai",
11179
+ support_h265: "1",
11180
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
11181
+ a_bogus: ""
11182
+ };
11183
+ 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");
11184
+ collectionParams.a_bogus = aBogus;
11185
+ const queryString = new URLSearchParams(collectionParams).toString();
11186
+ const res = await http.api({
11187
+ method: "get",
11188
+ url: `https://creator.douyin.com/web/api/mix/list/?${queryString}`,
11189
+ headers: {
11190
+ ...headers,
11191
+ "Content-Type": "application/json"
11192
+ }
11193
+ }, {
11194
+ retries: 3,
11195
+ retryDelay: 20,
11196
+ timeout: 3000
10512
11197
  });
10513
- const userInfo = {
10514
- uniqueId: "",
10515
- avatar: "",
10516
- name: ""
11198
+ const isSuccess = 0 === res.status_code;
11199
+ const message = `抖音获取合集${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11200
+ const data = isSuccess ? {
11201
+ collections: res?.mix_list || [],
11202
+ total: res?.mix_list?.length || 0
11203
+ } : {
11204
+ collections: [],
11205
+ total: 0
10517
11206
  };
10518
- try {
10519
- await new Promise((resolve, reject)=>{
10520
- let finished = false;
10521
- const timer = setTimeout(async ()=>{
10522
- cleanup();
10523
- executionState = types_ExecutionState.TIMEOUT;
10524
- await updateTaskState?.({
10525
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.TIMEOUT,
10526
- error: "等待扫码登录超时"
10527
- });
10528
- resolve();
10529
- }, douyinLogin_rpa_server_waitQrcodeResultMaxTime);
10530
- const cleanup = ()=>{
10531
- if (finished) return;
10532
- finished = true;
10533
- clearTimeout(timer);
10534
- page.off("response", handleWebCommon);
10535
- page.off("response", handleCheckQR);
10536
- task.steelBrowser?.off("disconnected", handleBrowserClosed);
10537
- };
10538
- const handleBrowserClosed = ()=>{
10539
- cleanup();
10540
- executionState = types_ExecutionState.BROWSER_CLOSED;
11207
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11208
+ };
11209
+ const DouyinGetHotParamsSchema = ActionCommonParamsSchema.extend({
11210
+ query: schemas_string().optional(),
11211
+ count: schemas_number().optional()
11212
+ });
11213
+ const { sign_datail: douyinGetHot_sign_datail, sign_reply: douyinGetHot_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11214
+ const douyinGetHot = async (_task, params)=>{
11215
+ const headers = {
11216
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11217
+ referer: "https://creator.douyin.com/",
11218
+ origin: "https://creator.douyin.com/"
11219
+ };
11220
+ const args = [
11221
+ {
11222
+ headers
11223
+ },
11224
+ _task.logger,
11225
+ params.proxyLoc,
11226
+ params.localIP,
11227
+ params.accountId
11228
+ ];
11229
+ const http = new Http(...args);
11230
+ const hotParams = {
11231
+ query: params.query || "",
11232
+ count: "50",
11233
+ aid: "1128",
11234
+ cookie_enabled: "0",
11235
+ screen_width: "1920",
11236
+ screen_height: "1200",
11237
+ browser_language: "zh-CN",
11238
+ browser_platform: "Win32",
11239
+ browser_name: "Mozilla",
11240
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11241
+ browser_online: "true",
11242
+ timezone_name: "Asia/Shanghai",
11243
+ support_h265: "1",
11244
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
11245
+ a_bogus: ""
11246
+ };
11247
+ 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");
11248
+ hotParams.a_bogus = aBogus;
11249
+ const queryString = new URLSearchParams(hotParams).toString();
11250
+ console.log("抖音获取热点参数:", queryString);
11251
+ const res = await http.api({
11252
+ method: "get",
11253
+ url: `https://creator.douyin.com/aweme/v1/hotspot/search/?${queryString}`,
11254
+ headers: {
11255
+ ...headers,
11256
+ "Content-Type": "application/json"
11257
+ }
11258
+ }, {
11259
+ retries: 3,
11260
+ retryDelay: 20,
11261
+ timeout: 3000
11262
+ });
11263
+ const isSuccess = 0 === res.status_code;
11264
+ const message = `抖音获取热点${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11265
+ const data = isSuccess ? {
11266
+ hot: res?.sentences || [],
11267
+ total: res?.sentences?.length || 0
11268
+ } : {
11269
+ hot: [],
11270
+ total: 0
11271
+ };
11272
+ console.log("抖音获取热点数据:", data);
11273
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11274
+ };
11275
+ const DouyinGetLocationParamsSchema = ActionCommonParamsSchema.extend({
11276
+ keyword: schemas_string().optional(),
11277
+ count: schemas_number().optional()
11278
+ });
11279
+ const { sign_datail: douyinGetLocation_sign_datail, sign_reply: douyinGetLocation_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11280
+ const douyinGetLocation = async (_task, params)=>{
11281
+ const headers = {
11282
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11283
+ referer: "https://creator.douyin.com/",
11284
+ origin: "https://creator.douyin.com/"
11285
+ };
11286
+ const args = [
11287
+ {
11288
+ headers
11289
+ },
11290
+ _task.logger,
11291
+ params.proxyLoc,
11292
+ params.localIP,
11293
+ params.accountId
11294
+ ];
11295
+ const http = new Http(...args);
11296
+ const keyword = params.keyword || "";
11297
+ const locationParams = {
11298
+ count: "1",
11299
+ from_webapp: "1",
11300
+ get_current_loc: "1",
11301
+ is_image_album_style: "1",
11302
+ search_type: "0",
11303
+ poi_anchor_tab: "2",
11304
+ page: "1",
11305
+ keyword: keyword,
11306
+ poi_mode: "{}",
11307
+ load_interest_city_type: "0",
11308
+ aid: "1128",
11309
+ cookie_enabled: "true",
11310
+ screen_width: "1920",
11311
+ screen_height: "1200",
11312
+ browser_language: "zh-CN",
11313
+ browser_platform: "Win32",
11314
+ browser_name: "Mozilla",
11315
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11316
+ browser_online: "true",
11317
+ timezone_name: "Asia/Shanghai",
11318
+ support_h265: "1",
11319
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
11320
+ a_bogus: ""
11321
+ };
11322
+ 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");
11323
+ locationParams.a_bogus = aBogus;
11324
+ const queryString = new URLSearchParams(locationParams).toString();
11325
+ const res = await http.api({
11326
+ method: "get",
11327
+ url: `https://creator.douyin.com/aweme/v1/life/video_api/search/poi/?${queryString}`,
11328
+ headers: {
11329
+ ...headers,
11330
+ "Content-Type": "application/json"
11331
+ }
11332
+ }, {
11333
+ retries: 3,
11334
+ retryDelay: 20,
11335
+ timeout: 3000
11336
+ });
11337
+ console.log("抖音获取位置响应:", res);
11338
+ const isSuccess = 0 === res.status_code;
11339
+ const message = `抖音获取位置${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11340
+ let locations = [];
11341
+ if (isSuccess && res?.poi_list) {
11342
+ 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;
11343
+ }
11344
+ const data = {
11345
+ locations,
11346
+ total: locations.length
11347
+ };
11348
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11349
+ };
11350
+ const DouyinGetMusicParamsSchema = ActionCommonParamsSchema.extend({
11351
+ keyword: schemas_string().optional(),
11352
+ count: schemas_number().optional()
11353
+ });
11354
+ const { sign_datail: douyinGetMusic_sign_datail, sign_reply: douyinGetMusic_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11355
+ const douyinGetMusic = async (_task, params)=>{
11356
+ const headers = {
11357
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11358
+ referer: "https://creator.douyin.com/",
11359
+ origin: "https://creator.douyin.com/"
11360
+ };
11361
+ const args = [
11362
+ {
11363
+ headers
11364
+ },
11365
+ _task.logger,
11366
+ params.proxyLoc,
11367
+ params.localIP,
11368
+ params.accountId
11369
+ ];
11370
+ const http = new Http(...args);
11371
+ const keyword = params.keyword || "";
11372
+ const musicParams = {
11373
+ keyword: keyword || "11",
11374
+ search_source: "normal_search",
11375
+ cout: "20",
11376
+ aid: "1128",
11377
+ cursor: "0",
11378
+ cookie_enabled: "true",
11379
+ screen_width: "1920",
11380
+ screen_height: "1200",
11381
+ browser_language: "zh-CN",
11382
+ browser_platform: "Win32",
11383
+ browser_name: "Mozilla",
11384
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11385
+ browser_online: "true",
11386
+ timezone_name: "Asia/Shanghai",
11387
+ support_h265: "1",
11388
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
11389
+ a_bogus: ""
11390
+ };
11391
+ 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");
11392
+ musicParams.a_bogus = aBogus;
11393
+ const queryString = new URLSearchParams(musicParams).toString();
11394
+ console.log("抖音获取音乐参数:", queryString);
11395
+ const authorizationParams = {
11396
+ aid: "1128",
11397
+ cookie_enabled: "true",
11398
+ screen_width: "1920",
11399
+ screen_height: "1200",
11400
+ browser_language: "zh-CN",
11401
+ browser_platform: "Win32",
11402
+ browser_name: "Mozilla",
11403
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11404
+ browser_online: "true",
11405
+ timezone_name: "Asia/Shanghai",
11406
+ support_h265: "1"
11407
+ };
11408
+ const authorizationQueryString = new URLSearchParams(authorizationParams).toString();
11409
+ const authorization = await http.api({
11410
+ method: "get",
11411
+ url: `https://creator.douyin.com/web/api/media/aweme/search/post/auth/?${authorizationQueryString}`,
11412
+ headers: {
11413
+ ...headers,
11414
+ "Content-Type": "application/json"
11415
+ }
11416
+ }, {
11417
+ retries: 3,
11418
+ retryDelay: 20,
11419
+ timeout: 3000
11420
+ });
11421
+ if (0 !== authorization.status_code) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, authorization.status_msg, {
11422
+ music: [],
11423
+ total: 0
11424
+ });
11425
+ console.log("抖音获取音乐权限:", authorization);
11426
+ const res = await http.api({
11427
+ method: "get",
11428
+ url: `https://tsearch.amemv.com/openapi/aweme/v1/music/search/?${queryString}`,
11429
+ headers: {
11430
+ ...headers,
11431
+ "agw-auth": authorization?.signature || "",
11432
+ "Content-Type": "application/json"
11433
+ }
11434
+ }, {
11435
+ retries: 3,
11436
+ retryDelay: 20,
11437
+ timeout: 3000
11438
+ });
11439
+ console.log("抖音获取音乐响应:", res);
11440
+ const isSuccess = 0 === res.status_code;
11441
+ const message = `抖音获取音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11442
+ const data = isSuccess ? {
11443
+ music: res?.music || [],
11444
+ total: res?.music?.length || 0
11445
+ } : {
11446
+ music: [],
11447
+ total: 0
11448
+ };
11449
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11450
+ };
11451
+ const DouyinGetMusicByCategoryParamsSchema = ActionCommonParamsSchema.extend({
11452
+ category_id: schemas_string().optional(),
11453
+ type: schemas_string().optional(),
11454
+ count: schemas_number().optional()
11455
+ });
11456
+ const { sign_datail: douyinGetMusicByCategory_sign_datail, sign_reply: douyinGetMusicByCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11457
+ const douyinGetMusicByCategory = async (_task, params)=>{
11458
+ const headers = {
11459
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11460
+ referer: "https://creator.douyin.com/",
11461
+ origin: "https://creator.douyin.com/"
11462
+ };
11463
+ const args = [
11464
+ {
11465
+ headers
11466
+ },
11467
+ _task.logger,
11468
+ params.proxyLoc,
11469
+ params.localIP,
11470
+ params.accountId
11471
+ ];
11472
+ const http = new Http(...args);
11473
+ const collectionParams = {
11474
+ status: "0,2",
11475
+ count: params.count?.toString() || "20",
11476
+ cursor: "0",
11477
+ source: "collection_create",
11478
+ aid: "1128",
11479
+ cookie_enabled: "true",
11480
+ screen_width: "1920",
11481
+ screen_height: "1200",
11482
+ browser_language: "zh-CN",
11483
+ browser_platform: "Win32",
11484
+ browser_name: "Mozilla",
11485
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11486
+ browser_online: "true",
11487
+ timezone_name: "Asia/Shanghai",
11488
+ support_h265: "1",
11489
+ type: params.type || "",
11490
+ category_id: params.category_id || "",
11491
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
11492
+ a_bogus: ""
11493
+ };
11494
+ 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");
11495
+ collectionParams.a_bogus = aBogus;
11496
+ const queryString = new URLSearchParams(collectionParams).toString();
11497
+ const res = await http.api({
11498
+ method: "get",
11499
+ url: `https://creator.douyin.com/web/api/media/music/list/?${queryString}`,
11500
+ headers: {
11501
+ ...headers,
11502
+ "Content-Type": "application/json"
11503
+ }
11504
+ }, {
11505
+ retries: 3,
11506
+ retryDelay: 20,
11507
+ timeout: 3000
11508
+ });
11509
+ const isSuccess = 0 === res.status_code;
11510
+ const message = `抖音获取推荐音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11511
+ const data = isSuccess ? {
11512
+ songs: res?.songs || []
11513
+ } : {
11514
+ songs: []
11515
+ };
11516
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11517
+ };
11518
+ const { sign_datail: douyinGetMusicCategory_sign_datail, sign_reply: douyinGetMusicCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11519
+ const DouyinGetMusicCategoryParamsSchema = ActionCommonParamsSchema.extend({});
11520
+ const douyinGetMusicCategory = async (_task, params)=>{
11521
+ const headers = {
11522
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11523
+ referer: "https://creator.douyin.com/",
11524
+ origin: "https://creator.douyin.com/"
11525
+ };
11526
+ const args = [
11527
+ {
11528
+ headers
11529
+ },
11530
+ _task.logger,
11531
+ params.proxyLoc,
11532
+ params.localIP,
11533
+ params.accountId
11534
+ ];
11535
+ const http = new Http(...args);
11536
+ const categoryParams = {
11537
+ status: "0,2",
11538
+ count: "50",
11539
+ cursor: "0",
11540
+ source: "collection_create",
11541
+ aid: "1128",
11542
+ cookie_enabled: "true",
11543
+ screen_width: "1920",
11544
+ screen_height: "1200",
11545
+ browser_language: "zh-CN",
11546
+ browser_platform: "Win32",
11547
+ browser_name: "Mozilla",
11548
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11549
+ browser_online: "true",
11550
+ timezone_name: "Asia/Shanghai",
11551
+ support_h265: "1",
11552
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
11553
+ a_bogus: ""
11554
+ };
11555
+ 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");
11556
+ categoryParams.a_bogus = aBogus;
11557
+ const queryString = new URLSearchParams(categoryParams).toString();
11558
+ const res = await http.api({
11559
+ method: "get",
11560
+ url: `https://creator.douyin.com/web/api/media/music/category?${queryString}`,
11561
+ headers: {
11562
+ ...headers,
11563
+ "Content-Type": "application/json"
11564
+ }
11565
+ }, {
11566
+ retries: 3,
11567
+ retryDelay: 20,
11568
+ timeout: 3000
11569
+ });
11570
+ const isSuccess = 0 === res.status_code;
11571
+ const message = `抖音获取音乐分类${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11572
+ const data = isSuccess ? {
11573
+ categorys: res?.categories || []
11574
+ } : {
11575
+ categorys: []
11576
+ };
11577
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11578
+ };
11579
+ const DouyinGetTopicsParamsSchema = ActionCommonParamsSchema.extend({
11580
+ keyword: schemas_string().optional(),
11581
+ count: schemas_number().optional()
11582
+ });
11583
+ const { sign_datail: douyinGetTopics_sign_datail, sign_reply: douyinGetTopics_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11584
+ const douyinGetTopics = async (_task, params)=>{
11585
+ const headers = {
11586
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11587
+ referer: "https://creator.douyin.com/",
11588
+ origin: "https://creator.douyin.com/"
11589
+ };
11590
+ const args = [
11591
+ {
11592
+ headers
11593
+ },
11594
+ _task.logger,
11595
+ params.proxyLoc,
11596
+ params.localIP,
11597
+ params.accountId
11598
+ ];
11599
+ const http = new Http(...args);
11600
+ const keyword = params.keyword || "";
11601
+ const topicParams = {
11602
+ keyword: keyword,
11603
+ source: "challenge_create",
11604
+ aid: "2906",
11605
+ cookie_enabled: "0",
11606
+ screen_width: "1920",
11607
+ screen_height: "1200",
11608
+ browser_language: "zh-CN",
11609
+ browser_platform: "Win32",
11610
+ browser_name: "Mozilla",
11611
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11612
+ browser_online: "true",
11613
+ timezone_name: "Asia/Shanghai",
11614
+ support_h265: "1",
11615
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
11616
+ a_bogus: ""
11617
+ };
11618
+ 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");
11619
+ topicParams.a_bogus = aBogus;
11620
+ const queryString = new URLSearchParams(topicParams).toString();
11621
+ console.log("抖音获取话题参数:", queryString);
11622
+ const res = await http.api({
11623
+ method: "get",
11624
+ url: `https://creator.douyin.com/aweme/v1/search/challengesug/?${queryString}`,
11625
+ headers: {
11626
+ ...headers,
11627
+ "Content-Type": "application/json"
11628
+ }
11629
+ }, {
11630
+ retries: 3,
11631
+ retryDelay: 20,
11632
+ timeout: 3000
11633
+ });
11634
+ console.log("抖音获取话题响应:", res);
11635
+ const isSuccess = 0 === res.status_code;
11636
+ const message = `抖音获取话题${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11637
+ const data = isSuccess ? {
11638
+ topics: res?.sug_list || [],
11639
+ total: res?.sug_list?.length || 0
11640
+ } : {
11641
+ topics: [],
11642
+ total: 0
11643
+ };
11644
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
11645
+ };
11646
+ const douyinLogin_rpa_server_scanRetryMaxCount = 60;
11647
+ const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
11648
+ const rpa_server_rpaServer = async (task, params)=>{
11649
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
11650
+ let executionState;
11651
+ let proxyUrl;
11652
+ if (params.localIP) {
11653
+ const args = [
11654
+ params.localIP,
11655
+ params.proxyLoc,
11656
+ params.accountId
11657
+ ];
11658
+ task.logger?.info(`==> 开始获取代理信息:${args}`);
11659
+ const ProxyAgentWithLogger = ProxyAgent.bind({
11660
+ logger: task.logger
11661
+ });
11662
+ const ProxyAgentResult = await ProxyAgentWithLogger(...args);
11663
+ task.logger?.info("==> 代理信息获取成功!");
11664
+ proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
11665
+ }
11666
+ const page = await task.createPage({
11667
+ url: "https://creator.douyin.com/",
11668
+ proxyUrl,
11669
+ userAgent: params.userAgent,
11670
+ ...params.viewport ? {
11671
+ viewport: params.viewport
11672
+ } : {}
11673
+ });
11674
+ await page.route("**/*.mp4", (route)=>route.abort());
11675
+ await page.route("**/*.png", (route)=>route.abort());
11676
+ await page.route("**/*.ttf", (route)=>route.abort());
11677
+ await page.addInitScript(()=>{
11678
+ window.requestAnimationFrame = ()=>0;
11679
+ });
11680
+ task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
11681
+ await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
11682
+ timeout: 15000
11683
+ });
11684
+ await page.waitForLoadState("networkidle");
11685
+ await page.goto("about:blank");
11686
+ await page.goBack({
11687
+ waitUntil: "domcontentloaded"
11688
+ });
11689
+ task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
11690
+ await page.locator(".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle").click();
11691
+ task.steelBrowser?.on("disconnected", async ()=>{
11692
+ const browserContext = task.steelBrowserContext;
11693
+ const browser = task.steelBrowser;
11694
+ executionState = types_ExecutionState.BROWSER_CLOSED;
11695
+ await page.close();
11696
+ if (browserContext) await browserContext.close();
11697
+ if (browser) await browser.close();
11698
+ });
11699
+ await updateTaskState?.({
11700
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.WAIT_SCAN,
11701
+ connectAddress: await task.steelConnector?.getLive(task.sessionId || ""),
11702
+ sessionId: task.sessionId
11703
+ });
11704
+ const userInfo = {
11705
+ uniqueId: "",
11706
+ avatar: "",
11707
+ name: ""
11708
+ };
11709
+ try {
11710
+ await new Promise((resolve, reject)=>{
11711
+ let finished = false;
11712
+ const timer = setTimeout(async ()=>{
11713
+ cleanup();
11714
+ executionState = types_ExecutionState.TIMEOUT;
11715
+ await updateTaskState?.({
11716
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.TIMEOUT,
11717
+ error: "等待扫码登录超时"
11718
+ });
11719
+ resolve();
11720
+ }, douyinLogin_rpa_server_waitQrcodeResultMaxTime);
11721
+ const cleanup = ()=>{
11722
+ if (finished) return;
11723
+ finished = true;
11724
+ clearTimeout(timer);
11725
+ page.off("response", handleWebCommon);
11726
+ page.off("response", handleCheckQR);
11727
+ task.steelBrowser?.off("disconnected", handleBrowserClosed);
11728
+ };
11729
+ const handleBrowserClosed = ()=>{
11730
+ cleanup();
11731
+ executionState = types_ExecutionState.BROWSER_CLOSED;
10541
11732
  resolve();
10542
11733
  };
10543
11734
  const handleWebCommon = async (resp)=>{
@@ -10650,22 +11841,43 @@ const rpa_server_rpaServer = async (task, params)=>{
10650
11841
  data: {}
10651
11842
  };
10652
11843
  }
10653
- case types_ExecutionState.SUCCESS:
10654
- await updateTaskState?.({
10655
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
10656
- result: {
10657
- cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
10658
- userInfo: userInfo
10659
- }
10660
- });
10661
- return {
10662
- code: 0,
10663
- message: "成功",
10664
- data: {
10665
- cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
10666
- userInfo
10667
- }
10668
- };
11844
+ case types_ExecutionState.SUCCESS:
11845
+ {
11846
+ let securityData = {};
11847
+ try {
11848
+ securityData = await page.evaluate(()=>({
11849
+ "security-sdk/s_sdk_pri_key": localStorage.getItem("security-sdk/s_sdk_pri_key") || "",
11850
+ "security-sdk/s_sdk_pub_key": localStorage.getItem("security-sdk/s_sdk_pub_key") || "",
11851
+ "security-sdk/s_sdk_sign_data_key": localStorage.getItem("security-sdk/s_sdk_sign_data_key/web_protect") || ""
11852
+ }));
11853
+ task.logger.info("Security SDK 数据提取成功:", {
11854
+ "security-sdk/s_sdk_pri_key": !!securityData["security-sdk/s_sdk_pri_key"],
11855
+ "security-sdk/s_sdk_pub_key": !!securityData["security-sdk/s_sdk_pub_key"],
11856
+ "security-sdk/s_sdk_sign_data_key": !!securityData["security-sdk/s_sdk_sign_data_key"]
11857
+ });
11858
+ } catch (error) {
11859
+ task.logger.warn("提取 Security SDK 数据失败:", {
11860
+ error: error instanceof Error ? error.message : String(error)
11861
+ });
11862
+ }
11863
+ await updateTaskState?.({
11864
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
11865
+ result: {
11866
+ cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
11867
+ ...securityData,
11868
+ userInfo: userInfo
11869
+ }
11870
+ });
11871
+ return {
11872
+ code: 0,
11873
+ message: "成功",
11874
+ data: {
11875
+ cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
11876
+ ...securityData,
11877
+ userInfo
11878
+ }
11879
+ };
11880
+ }
10669
11881
  default:
10670
11882
  return {
10671
11883
  code: 500,
@@ -10679,6 +11891,472 @@ const douyinLogin = async (task, params)=>{
10679
11891
  if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
10680
11892
  return executeAction(rpa_server_rpaServer)(task, params);
10681
11893
  };
11894
+ const { sign_reply: mock_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
11895
+ const { generateReqSignFromTicket } = __webpack_require__("./src/utils/douyin/reqSign.js.js");
11896
+ const { generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/csrfToken.js");
11897
+ const { generateAuthorization, randomS, canonicalQueryString, calculateFileCrc32 } = __webpack_require__("./src/utils/douyin/douyinSign.js");
11898
+ const mock_mockAction = async (task, params)=>{
11899
+ const tmpCachePath = task.getTmpPath();
11900
+ let bdTicketGuardClientDataV2 = params.cookies.find((e)=>"bd_ticket_guard_client_data" === e.name)?.value || "";
11901
+ if (!bdTicketGuardClientDataV2) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "bdTicketGuardClientDataV2 不能为空", "");
11902
+ bdTicketGuardClientDataV2 = decodeURIComponent(bdTicketGuardClientDataV2);
11903
+ console.log("原始 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
11904
+ try {
11905
+ bdTicketGuardClientDataV2 = atob(bdTicketGuardClientDataV2);
11906
+ console.log("解码后 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
11907
+ } catch (error) {
11908
+ console.error("bdTicketGuardClientDataV2 解码失败:", error);
11909
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, "bdTicketGuardClientDataV2 解码失败", "");
11910
+ }
11911
+ let ree_public_key = "";
11912
+ let ts_sign = "";
11913
+ try {
11914
+ const parsed = JSON.parse(bdTicketGuardClientDataV2);
11915
+ ree_public_key = parsed.ree_public_key || "";
11916
+ ts_sign = parsed.ts_sign || "";
11917
+ } catch {}
11918
+ const privateKey = params["security-sdk/s_sdk_pri_key"]?.data || "";
11919
+ const publicKey = params["security-sdk/s_sdk_pub_key"]?.data || "";
11920
+ const signData = JSON.parse(params["security-sdk/s_sdk_sign_data_key/web_protect"]?.data || "{}");
11921
+ console.log("privateKey:", privateKey);
11922
+ console.log("publicKey:", publicKey);
11923
+ console.log("signData:", signData);
11924
+ let bdTicketGuardClientData = {
11925
+ ts_sign,
11926
+ req_content: "ticket,path,timestamp",
11927
+ timestamp: Math.floor(Date.now() / 1000),
11928
+ req_sign: generateReqSignFromTicket(signData.ticket, privateKey)
11929
+ };
11930
+ console.log("bdTicketGuardClientData:", bdTicketGuardClientData);
11931
+ bdTicketGuardClientData = btoa(JSON.stringify(bdTicketGuardClientData));
11932
+ const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
11933
+ if (!sessionidCookie) return {
11934
+ code: 414,
11935
+ message: "账号数据异常,请重新绑定账号后重试。",
11936
+ data: ""
11937
+ };
11938
+ const headers = {
11939
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11940
+ origin: "https://creator.douyin.com",
11941
+ referer: "https://creator.douyin.com/",
11942
+ "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"
11943
+ };
11944
+ const publishParams = {
11945
+ read_aid: "2906",
11946
+ aid: "1128",
11947
+ cookie_enabled: "true",
11948
+ screen_width: "1920",
11949
+ screen_height: "1200",
11950
+ browser_language: "zh-CN",
11951
+ browser_platform: "Win32",
11952
+ browser_name: "Mozilla",
11953
+ browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
11954
+ browser_online: "true",
11955
+ timezone_name: "Asia/Shanghai",
11956
+ support_h265: "1",
11957
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
11958
+ a_bogus: ""
11959
+ };
11960
+ const publishData = {
11961
+ item: {
11962
+ common: {
11963
+ text: params.title || "32234。sdsadadasda",
11964
+ text_extra: '[{"start":0,"end":5,"hashtag_id":0,"hashtag_name":"","type":7},{"start":5,"end":6,"hashtag_id":0,"hashtag_name":"","type":8}]',
11965
+ activity: "[]",
11966
+ challenges: "[]",
11967
+ hashtag_source: "",
11968
+ mentions: "[]",
11969
+ music_id: "",
11970
+ music_end_time: 0,
11971
+ hot_sentence: "",
11972
+ visibility_type: 0,
11973
+ download: 0,
11974
+ timing: -1,
11975
+ media_type: 2,
11976
+ images: []
11977
+ },
11978
+ cover: {
11979
+ poster: ""
11980
+ },
11981
+ mix: {},
11982
+ anchor: {
11983
+ poi_name: "",
11984
+ poi_id: "",
11985
+ anchor_content: "{}"
11986
+ },
11987
+ declare: {
11988
+ user_declare_info: "{}"
11989
+ }
11990
+ }
11991
+ };
11992
+ 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");
11993
+ publishParams.a_bogus = aBogus;
11994
+ const queryString = new URLSearchParams(publishParams).toString();
11995
+ const args = [
11996
+ {
11997
+ headers
11998
+ },
11999
+ task.logger,
12000
+ params.proxyLoc,
12001
+ params.localIP,
12002
+ params.accountId
12003
+ ];
12004
+ const http = new Http({
12005
+ headers
12006
+ });
12007
+ const proxyHttp = new Http(...args);
12008
+ const uploadAuth = await proxyHttp.api({
12009
+ method: "get",
12010
+ url: `https://creator.douyin.com/web/api/media/upload/auth/v5/?${queryString}`,
12011
+ headers: {
12012
+ ...headers,
12013
+ "Content-Type": "application/json"
12014
+ }
12015
+ }, {
12016
+ retries: 3,
12017
+ retryDelay: 20,
12018
+ timeout: 3000
12019
+ });
12020
+ if (!uploadAuth.auth) {
12021
+ console.log("uploadAuth", JSON.stringify(uploadAuth));
12022
+ return {
12023
+ code: 414,
12024
+ message: uploadAuth.status_msg || "获取上传权限失败",
12025
+ data: ""
12026
+ };
12027
+ }
12028
+ async function GetUploadAddr(imgUrl, isCover) {
12029
+ const auth = JSON.parse(uploadAuth.auth);
12030
+ const times = new Date();
12031
+ const amzDate = times.toISOString().replace(/\.\d{3}Z$/, "Z").replace(/[:-]/g, "");
12032
+ const region = "cn-north-1";
12033
+ const service = "imagex";
12034
+ const sessionToken = auth.SessionToken;
12035
+ const accessKeyID = auth.AccessKeyID;
12036
+ const secretAccessKey = auth.SecretAccessKey;
12037
+ const addrParamsConfig = {
12038
+ accessKeyId: accessKeyID,
12039
+ secretAccessKey: secretAccessKey,
12040
+ sessionToken: sessionToken,
12041
+ region: region,
12042
+ service: service,
12043
+ method: "GET",
12044
+ pathname: "/",
12045
+ params: {
12046
+ Action: "ApplyImageUpload",
12047
+ ServiceId: "jm8ajry58r",
12048
+ Version: "2018-08-01",
12049
+ app_id: "2906",
12050
+ s: randomS(),
12051
+ user_id: ""
12052
+ }
12053
+ };
12054
+ const result = generateAuthorization(addrParamsConfig).authorization;
12055
+ const addrParamsQueryString = canonicalQueryString(addrParamsConfig.params);
12056
+ const uploadAddr = await proxyHttp.api({
12057
+ method: "get",
12058
+ url: `https://imagex.bytedanceapi.com/?${addrParamsQueryString}`,
12059
+ headers: {
12060
+ ...headers,
12061
+ Authorization: result,
12062
+ "Content-Type": "application/json",
12063
+ "X-amz-date": amzDate,
12064
+ "X-amz-security-token": sessionToken
12065
+ }
12066
+ }, {
12067
+ retries: 3,
12068
+ retryDelay: 20,
12069
+ timeout: 3000
12070
+ });
12071
+ if (!uploadAddr?.Result?.RequestId) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, "获取上传地址失败", "");
12072
+ const fileBuffer = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(imgUrl);
12073
+ const uploadImgResp = await proxyHttp.api({
12074
+ method: "post",
12075
+ url: `https://tos-hl-x.snssdk.com/upload/v1/${uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri}`,
12076
+ headers: {
12077
+ ...headers,
12078
+ Authorization: uploadAddr.Result.UploadAddress.StoreInfos[0].Auth,
12079
+ "Content-crc32": calculateFileCrc32(imgUrl),
12080
+ "Content-Type": "application/octet-stream"
12081
+ },
12082
+ data: fileBuffer
12083
+ }, {
12084
+ retries: 3,
12085
+ retryDelay: 20,
12086
+ timeout: 3000
12087
+ });
12088
+ if (2000 === uploadImgResp.code) return isCover ? uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri : {
12089
+ uri: uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri,
12090
+ width: 1258,
12091
+ height: 1048
12092
+ };
12093
+ }
12094
+ if (params.coverImage) {
12095
+ const images = await Promise.all([
12096
+ params.coverImage
12097
+ ].map((url)=>{
12098
+ if (!url) throw new Error("封面图片 URL 不能为空");
12099
+ const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
12100
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
12101
+ }));
12102
+ const coverUploadAddr = await GetUploadAddr(images[0], true);
12103
+ publishData.item.cover = {
12104
+ poster: coverUploadAddr
12105
+ };
12106
+ }
12107
+ if (params.banners) {
12108
+ const images = await Promise.all(params.banners.map((url)=>{
12109
+ if (!url) throw new Error("内容图片 URL 不能为空");
12110
+ const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
12111
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
12112
+ }));
12113
+ const contentUploadAddr = await Promise.all(images.map((url)=>GetUploadAddr(url, false)));
12114
+ publishData.item.common.images = contentUploadAddr;
12115
+ }
12116
+ proxyHttp.addResponseInterceptor((response)=>{
12117
+ if (!response || !response.data) return;
12118
+ const responseData = response.data;
12119
+ if (response && responseData?.status_code && 0 !== responseData.status_code) return {
12120
+ code: responseData?.status_code,
12121
+ message: responseData.status_msg || "文章发布异常,请稍后重试。",
12122
+ data: responseData
12123
+ };
12124
+ });
12125
+ task._timerRecord.PrePublish = Date.now();
12126
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
12127
+ const publishQuery = {
12128
+ ...publishParams
12129
+ };
12130
+ 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");
12131
+ const publishQueryParams = new URLSearchParams(publishQuery).toString();
12132
+ function generateRandomString(length) {
12133
+ const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
12134
+ let randomString = "";
12135
+ for(let i = 0; i < length; i++){
12136
+ const randomIndex = Math.floor(Math.random() * characters.length);
12137
+ randomString += characters.charAt(randomIndex);
12138
+ }
12139
+ return randomString;
12140
+ }
12141
+ publishData.item.common.creation_id = generateRandomString(8) + Date.now();
12142
+ const csrfToken = generateCsrfTokenAdvanced({
12143
+ cookies: params.cookies,
12144
+ url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
12145
+ method: "POST",
12146
+ userAgent: headers["user-agent"]
12147
+ });
12148
+ console.log("发布数据", JSON.stringify(publishData));
12149
+ const publishResult = await proxyHttp.api({
12150
+ method: "post",
12151
+ url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
12152
+ data: publishData,
12153
+ defaultErrorMsg: "发布异常,请稍后重试。",
12154
+ headers: {
12155
+ ...headers,
12156
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
12157
+ "Content-Type": "application/json",
12158
+ "Bd-ticket-guard-client-data": bdTicketGuardClientData,
12159
+ "Bd-ticket-guard-ree-public-key": ree_public_key,
12160
+ "Bd-ticket-guard-version": 2,
12161
+ "Bd-ticket-guard-web-sign-type": 1,
12162
+ "Bd-ticket-guard-web-version": 2,
12163
+ "X-secsdk-csrf-token": csrfToken,
12164
+ "X-tt-session-dtrait": params.cookies.find((e)=>"x-tt-session-dtrait" === e.name)?.value || ""
12165
+ }
12166
+ }, {
12167
+ retries: 2,
12168
+ retryDelay: 500,
12169
+ timeout: 12000
12170
+ });
12171
+ console.log("publishResult", publishResult);
12172
+ const isSuccess = 0 === publishResult.status_code;
12173
+ const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
12174
+ const data = isSuccess ? publishResult.item_id || "" : "";
12175
+ if (!isSuccess) {
12176
+ await updateTaskState?.({
12177
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
12178
+ error: message
12179
+ });
12180
+ return {
12181
+ code: 414,
12182
+ data,
12183
+ message
12184
+ };
12185
+ }
12186
+ await updateTaskState?.({
12187
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
12188
+ result: {
12189
+ response: data
12190
+ }
12191
+ });
12192
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
12193
+ };
12194
+ const douyinPublish_rpa_rpaAction = async (task, params)=>{
12195
+ const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
12196
+ const commonCookies = {
12197
+ path: "/",
12198
+ secure: true,
12199
+ domain: "douyin.com",
12200
+ url: "https://creator.douyin.com",
12201
+ httpOnly: true
12202
+ };
12203
+ const page = await task.createPage({
12204
+ show: task.debug,
12205
+ url: params.url || "https://creator.douyin.com/creator-micro/content/upload?default-tab=3",
12206
+ cookies: params.cookies?.map((it)=>({
12207
+ ...it,
12208
+ ...commonCookies
12209
+ }))
12210
+ });
12211
+ await updateTaskState?.({
12212
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.ACTION,
12213
+ connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
12214
+ sessionId: task.sessionId
12215
+ });
12216
+ const tmpCachePath = task.getTmpPath();
12217
+ try {
12218
+ await page.waitForSelector("#micro", {
12219
+ state: "visible",
12220
+ timeout: 20000
12221
+ });
12222
+ } catch (error) {
12223
+ return {
12224
+ code: 414,
12225
+ message: "登录失效",
12226
+ data: page.url()
12227
+ };
12228
+ }
12229
+ const images = await Promise.all([
12230
+ "https://svip-8.rcouyi.com/file/draw/volc/2026/01/15/2011725723554811904.png"
12231
+ ].map((url)=>{
12232
+ const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
12233
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
12234
+ }));
12235
+ const fileChooser = await page.waitForSelector('input[type="file"]', {
12236
+ timeout: 20000
12237
+ });
12238
+ if (fileChooser) await fileChooser.setInputFiles(images);
12239
+ const titleInstance = page.locator(".semi-input-wrapper input[placeholder='添加作品标题']");
12240
+ await titleInstance.waitFor({
12241
+ state: "visible",
12242
+ timeout: 50000
12243
+ });
12244
+ await titleInstance.click();
12245
+ await titleInstance.fill(params.title || "1111");
12246
+ await page.waitForTimeout(1000);
12247
+ const descInstance = page.locator("div[data-placeholder='添加作品描述...']");
12248
+ await descInstance.click();
12249
+ await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, "") || "22222");
12250
+ if ("2" === params.visibleRange) await page.locator("label:has-text('好友可见')").first().click();
12251
+ else if ("3" === params.visibleRange) await page.locator("label:has-text('仅自己可见')").first().click();
12252
+ if (!params.isImmediatelyPublish) {
12253
+ await await page.locator('label:has-text("定时发布")').first().click();
12254
+ await page.waitForTimeout(500);
12255
+ const releaseTimeInstance = page.locator(".semi-datepicker-input input[placeholder='日期和时间']");
12256
+ await releaseTimeInstance.click();
12257
+ await page.waitForTimeout(1000);
12258
+ await releaseTimeInstance.fill(params.scheduledPublish || "2026-02-01 15:30:30");
12259
+ await releaseTimeInstance.blur();
12260
+ }
12261
+ const response = await new Promise((resolve)=>{
12262
+ const handleResponse = async (response)=>{
12263
+ if (response.url().includes("/web/api/media/aweme/create_v2")) {
12264
+ console.log("匹配到发布接口响应");
12265
+ const jsonResponse = await response.json();
12266
+ console.log("发布接口响应数据:", jsonResponse);
12267
+ page.off("response", handleResponse);
12268
+ resolve(jsonResponse?.data?.item_id);
12269
+ }
12270
+ };
12271
+ console.log("监听响应事件");
12272
+ page.on("response", handleResponse);
12273
+ console.log("点击发布按钮");
12274
+ page.locator("#DCPF button:has-text('发布')").first().click();
12275
+ console.log("发布按钮已点击");
12276
+ });
12277
+ await updateTaskState?.({
12278
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
12279
+ result: {
12280
+ response
12281
+ }
12282
+ });
12283
+ await page.close();
12284
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(response);
12285
+ };
12286
+ const FictionalRendition = schemas_object({
12287
+ type: literal("fictional-rendition")
12288
+ });
12289
+ const AIGenerated = schemas_object({
12290
+ type: literal("ai-generated")
12291
+ });
12292
+ const SourceStatement = schemas_object({
12293
+ type: literal("source-statement"),
12294
+ childType: schemas_enum([
12295
+ "self-labeling",
12296
+ "self-shooting",
12297
+ "transshipment"
12298
+ ]),
12299
+ shootingLocation: schemas_object({
12300
+ id: schemas_string(),
12301
+ name: schemas_string(),
12302
+ latitude: schemas_number().optional(),
12303
+ longitude: schemas_number().optional()
12304
+ }).optional(),
12305
+ shootingDate: schemas_string().optional(),
12306
+ sourceMedia: schemas_string().optional()
12307
+ });
12308
+ union([
12309
+ FictionalRendition,
12310
+ AIGenerated,
12311
+ SourceStatement
12312
+ ]);
12313
+ const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
12314
+ banners: schemas_array(schemas_string()),
12315
+ title: schemas_string(),
12316
+ content: schemas_string(),
12317
+ coverImage: schemas_string().optional(),
12318
+ videoFile: schemas_string().optional(),
12319
+ address: schemas_object({
12320
+ id: schemas_string(),
12321
+ name: schemas_string(),
12322
+ latitude: schemas_number().optional(),
12323
+ longitude: schemas_number().optional()
12324
+ }).optional(),
12325
+ selfDeclaration: custom().optional(),
12326
+ topic: schemas_array(schemas_object({
12327
+ id: schemas_string(),
12328
+ word: schemas_string()
12329
+ })).optional(),
12330
+ proxyLoc: schemas_string().optional(),
12331
+ localIP: schemas_string().optional(),
12332
+ visibleRange: schemas_enum([
12333
+ "1",
12334
+ "2",
12335
+ "3"
12336
+ ]).optional(),
12337
+ isImmediatelyPublish: schemas_boolean().optional(),
12338
+ scheduledPublish: schemas_string().optional(),
12339
+ isOriginal: schemas_boolean().optional(),
12340
+ allowCoProduce: schemas_boolean().optional(),
12341
+ allowCopy: schemas_boolean().optional(),
12342
+ publishType: schemas_enum([
12343
+ "1",
12344
+ "2",
12345
+ "3",
12346
+ "4"
12347
+ ]).optional(),
12348
+ publishAction: schemas_enum([
12349
+ "publish",
12350
+ "draft"
12351
+ ]).optional(),
12352
+ isAiCoverImage: schemas_boolean().optional(),
12353
+ summary: schemas_string().optional()
12354
+ });
12355
+ const douyinPublish = async (task, params)=>{
12356
+ if ("rpa" === params.actionType) return douyinPublish_rpa_rpaAction(task, params);
12357
+ if ("mockApi" === params.actionType) return mock_mockAction(task, params);
12358
+ return executeAction(mock_mockAction, douyinPublish_rpa_rpaAction)(task, params);
12359
+ };
10682
12360
  const getBaijiahaoActivity = async (_task, params)=>{
10683
12361
  const cookies = params.cookies ?? [];
10684
12362
  const http = new Http({
@@ -12828,7 +14506,7 @@ const get3101DetailError = (errorList, message, saveType)=>{
12828
14506
  else if (message?.includes("资料审核")) error = errorList[2];
12829
14507
  return error || ("draft" === saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。");
12830
14508
  };
12831
- const mock_mockAction = async (task, params)=>{
14509
+ const toutiaoPublish_mock_mockAction = async (task, params)=>{
12832
14510
  const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
12833
14511
  const tmpCachePath = task.getTmpPath();
12834
14512
  const headers = {
@@ -13336,8 +15014,8 @@ const getAddTypeValue = (toutiaoAd)=>"yes" === toutiaoAd ? 3 : 2;
13336
15014
  const toutiaoPublish = async (task, params)=>{
13337
15015
  params.content = formatSectionHtml(params.content);
13338
15016
  if ("rpa" === params.actionType) return toutiaoPublish_rpa_rpaAction(task, params);
13339
- if ("mockApi" === params.actionType) return mock_mockAction(task, params);
13340
- return executeAction(mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
15017
+ if ("mockApi" === params.actionType) return toutiaoPublish_mock_mockAction(task, params);
15018
+ return executeAction(toutiaoPublish_mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
13341
15019
  };
13342
15020
  const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
13343
15021
  const tmpCachePath = task.getTmpPath();
@@ -17133,13 +18811,13 @@ const rpaAction_Server_Mock = async (task, params)=>{
17133
18811
  });
17134
18812
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, message);
17135
18813
  };
17136
- const FictionalRendition = schemas_object({
18814
+ const xiaohongshuPublish_FictionalRendition = schemas_object({
17137
18815
  type: literal("fictional-rendition")
17138
18816
  });
17139
- const AIGenerated = schemas_object({
18817
+ const xiaohongshuPublish_AIGenerated = schemas_object({
17140
18818
  type: literal("ai-generated")
17141
18819
  });
17142
- const SourceStatement = schemas_object({
18820
+ const xiaohongshuPublish_SourceStatement = schemas_object({
17143
18821
  type: literal("source-statement"),
17144
18822
  childType: schemas_enum([
17145
18823
  "self-labeling",
@@ -17151,9 +18829,9 @@ const SourceStatement = schemas_object({
17151
18829
  sourceMedia: schemas_string().optional()
17152
18830
  });
17153
18831
  union([
17154
- FictionalRendition,
17155
- AIGenerated,
17156
- SourceStatement
18832
+ xiaohongshuPublish_FictionalRendition,
18833
+ xiaohongshuPublish_AIGenerated,
18834
+ xiaohongshuPublish_SourceStatement
17157
18835
  ]);
17158
18836
  const XiaohongshuPublishParamsSchema = ActionCommonParamsSchema.extend({
17159
18837
  banners: schemas_array(schemas_string()),
@@ -17840,6 +19518,9 @@ class Action {
17840
19518
  BjhSessionCheck(params) {
17841
19519
  return this.bindTask(BjhSessionCheck, params);
17842
19520
  }
19521
+ DySessionCheck(params) {
19522
+ return this.bindTask(DySessionCheck, params);
19523
+ }
17843
19524
  searchToutiaoTopicList(params) {
17844
19525
  return this.bindTask(searchToutiaoTopicList, params);
17845
19526
  }
@@ -17915,8 +19596,35 @@ class Action {
17915
19596
  weixinPublish(params) {
17916
19597
  return this.bindTask(weixinPublish, params);
17917
19598
  }
19599
+ douyinPublish(params) {
19600
+ return this.bindTask(douyinPublish, params);
19601
+ }
19602
+ douyinGetTopics(params) {
19603
+ return this.bindTask(douyinGetTopics, params);
19604
+ }
19605
+ douyinGetMusicCategory(params) {
19606
+ return this.bindTask(douyinGetMusicCategory, params);
19607
+ }
19608
+ douyinGetMusicByCategory(params) {
19609
+ return this.bindTask(douyinGetMusicByCategory, params);
19610
+ }
19611
+ douyinGetMusic(params) {
19612
+ return this.bindTask(douyinGetMusic, params);
19613
+ }
19614
+ douyinGetLocation(params) {
19615
+ return this.bindTask(douyinGetLocation, params);
19616
+ }
19617
+ douyinGetHot(params) {
19618
+ return this.bindTask(douyinGetHot, params);
19619
+ }
19620
+ douyinGetCollection(params) {
19621
+ return this.bindTask(douyinGetCollection, params);
19622
+ }
19623
+ douyinLogin(params) {
19624
+ return this.bindTask(douyinLogin, params);
19625
+ }
17918
19626
  }
17919
19627
  var __webpack_exports__version = package_namespaceObject.i8;
17920
- export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
19628
+ export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinGetCollectionParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
17921
19629
 
17922
19630
  //# sourceMappingURL=index.mjs.map