@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/actions/common/sessionCheck/index.d.ts +6 -0
- package/dist/actions/douyinGetCollection/index.d.ts +27 -0
- package/dist/actions/douyinGetCollection/schema.d.ts +33 -0
- package/dist/actions/douyinGetHot/index.d.ts +30 -0
- package/dist/actions/douyinGetHot/schema.d.ts +33 -0
- package/dist/actions/douyinGetLocation/index.d.ts +30 -0
- package/dist/actions/douyinGetLocation/schema.d.ts +33 -0
- package/dist/actions/douyinGetMusic/index.d.ts +33 -0
- package/dist/actions/douyinGetMusic/schema.d.ts +33 -0
- package/dist/actions/douyinGetMusicByCategory/index.d.ts +26 -0
- package/dist/actions/douyinGetMusicByCategory/schema.d.ts +34 -0
- package/dist/actions/douyinGetMusicCategory/index.d.ts +46 -0
- package/dist/actions/douyinGetMusicCategory/schema.d.ts +33 -0
- package/dist/actions/douyinGetTopics/index.d.ts +27 -0
- package/dist/actions/douyinGetTopics/schema.d.ts +33 -0
- package/dist/actions/douyinPublish/index.d.ts +102 -0
- package/dist/actions/douyinPublish/mock.d.ts +2 -0
- package/dist/actions/douyinPublish/rpa.d.ts +2 -0
- package/dist/bundle.js +1798 -107
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +48 -0
- package/dist/index.js +1794 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1817 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1720,6 +1720,640 @@ var __webpack_modules__ = {
|
|
|
1720
1720
|
}
|
|
1721
1721
|
module.exports = GenXSCommon;
|
|
1722
1722
|
},
|
|
1723
|
+
"./src/utils/douyin/csrfToken.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1724
|
+
const crypto = __webpack_require__("crypto");
|
|
1725
|
+
function generateCsrfToken(options = {}) {
|
|
1726
|
+
const { cookies = [], url = '', method = 'POST' } = options;
|
|
1727
|
+
const sessionid = getCookieValue(cookies, 'sessionid') || '';
|
|
1728
|
+
const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
|
|
1729
|
+
const msToken = getCookieValue(cookies, 'msToken') || '';
|
|
1730
|
+
const ttwid = getCookieValue(cookies, 'ttwid') || '';
|
|
1731
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
1732
|
+
const version = '0000';
|
|
1733
|
+
const timestampHex = timestamp.toString(16).padStart(8, '0');
|
|
1734
|
+
const random = generateRandomHex(8);
|
|
1735
|
+
const signData = `${method}${url}${sessionid}${uid_tt}${msToken}${ttwid}${timestamp}`;
|
|
1736
|
+
const hash = crypto.createHash('md5').update(signData).digest('hex');
|
|
1737
|
+
const csrfToken = `0001${version}${timestampHex}${random}${hash}`;
|
|
1738
|
+
return csrfToken;
|
|
1739
|
+
}
|
|
1740
|
+
function getCookieValue(cookies, name) {
|
|
1741
|
+
const cookie = cookies.find((c)=>c.name === name);
|
|
1742
|
+
return cookie ? cookie.value : '';
|
|
1743
|
+
}
|
|
1744
|
+
function generateRandomHex(length) {
|
|
1745
|
+
const bytes = crypto.randomBytes(Math.ceil(length / 2));
|
|
1746
|
+
return bytes.toString('hex').slice(0, length);
|
|
1747
|
+
}
|
|
1748
|
+
function generateCsrfTokenAdvanced(options = {}) {
|
|
1749
|
+
const { cookies = [], url = '', method = 'POST', userAgent = '' } = options;
|
|
1750
|
+
const sessionid = getCookieValue(cookies, 'sessionid') || '';
|
|
1751
|
+
const sid_guard = getCookieValue(cookies, 'sid_guard') || '';
|
|
1752
|
+
const uid_tt = getCookieValue(cookies, 'uid_tt') || '';
|
|
1753
|
+
const msToken = getCookieValue(cookies, 'msToken') || '';
|
|
1754
|
+
const ttwid = getCookieValue(cookies, 'ttwid') || '';
|
|
1755
|
+
const odin_tt = getCookieValue(cookies, 'odin_tt') || '';
|
|
1756
|
+
const timestamp = Date.now();
|
|
1757
|
+
const timestampSec = Math.floor(timestamp / 1000);
|
|
1758
|
+
let pathname = '';
|
|
1759
|
+
try {
|
|
1760
|
+
const urlObj = new URL(url, 'https://creator.douyin.com');
|
|
1761
|
+
pathname = urlObj.pathname;
|
|
1762
|
+
} catch (e) {
|
|
1763
|
+
pathname = url;
|
|
1764
|
+
}
|
|
1765
|
+
const signParts = [
|
|
1766
|
+
method.toUpperCase(),
|
|
1767
|
+
pathname,
|
|
1768
|
+
timestampSec,
|
|
1769
|
+
sessionid,
|
|
1770
|
+
sid_guard,
|
|
1771
|
+
uid_tt,
|
|
1772
|
+
msToken,
|
|
1773
|
+
ttwid,
|
|
1774
|
+
odin_tt,
|
|
1775
|
+
userAgent
|
|
1776
|
+
].filter(Boolean);
|
|
1777
|
+
const signData = signParts.join('|');
|
|
1778
|
+
const firstHash = crypto.createHash('md5').update(signData).digest('hex');
|
|
1779
|
+
const secondHash = crypto.createHash('md5').update(firstHash + timestamp).digest('hex');
|
|
1780
|
+
const timestampHex = timestampSec.toString(16).padStart(8, '0');
|
|
1781
|
+
const random = generateRandomHex(16);
|
|
1782
|
+
return `0001000${timestampHex.slice(0, 2)}${random}${secondHash}`;
|
|
1783
|
+
}
|
|
1784
|
+
function generateCsrfTokenSimple(cookies = []) {
|
|
1785
|
+
const sessionid = getCookieValue(cookies, 'sessionid') || 'default_session';
|
|
1786
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
1787
|
+
const random = generateRandomHex(32);
|
|
1788
|
+
const hash = crypto.createHash('md5').update(`${sessionid}${timestamp}${random}`).digest('hex');
|
|
1789
|
+
const timestampHex = timestamp.toString(16).padStart(8, '0');
|
|
1790
|
+
return `0001000${timestampHex}${random}${hash}`.slice(0, 90);
|
|
1791
|
+
}
|
|
1792
|
+
function parseCsrfToken(token) {
|
|
1793
|
+
if (!token || token.length < 20) return null;
|
|
1794
|
+
try {
|
|
1795
|
+
const prefix = token.slice(0, 4);
|
|
1796
|
+
const version = token.slice(4, 8);
|
|
1797
|
+
const timestampHex = token.slice(8, 16);
|
|
1798
|
+
const timestamp = parseInt(timestampHex, 16);
|
|
1799
|
+
const date = new Date(1000 * timestamp);
|
|
1800
|
+
return {
|
|
1801
|
+
prefix,
|
|
1802
|
+
version,
|
|
1803
|
+
timestamp,
|
|
1804
|
+
date: date.toISOString(),
|
|
1805
|
+
isValid: '0001' === prefix
|
|
1806
|
+
};
|
|
1807
|
+
} catch (e) {
|
|
1808
|
+
return null;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
module.exports = {
|
|
1812
|
+
generateCsrfToken,
|
|
1813
|
+
generateCsrfTokenAdvanced,
|
|
1814
|
+
generateCsrfTokenSimple,
|
|
1815
|
+
parseCsrfToken
|
|
1816
|
+
};
|
|
1817
|
+
},
|
|
1818
|
+
"./src/utils/douyin/douyin.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1819
|
+
"use strict";
|
|
1820
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1821
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1822
|
+
sign_datail: ()=>sign_datail,
|
|
1823
|
+
sign_reply: ()=>sign_reply
|
|
1824
|
+
});
|
|
1825
|
+
function rc4_encrypt(plaintext, key) {
|
|
1826
|
+
var s = [];
|
|
1827
|
+
for(var i = 0; i < 256; i++)s[i] = i;
|
|
1828
|
+
var j = 0;
|
|
1829
|
+
for(var i = 0; i < 256; i++){
|
|
1830
|
+
j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
|
|
1831
|
+
var temp = s[i];
|
|
1832
|
+
s[i] = s[j];
|
|
1833
|
+
s[j] = temp;
|
|
1834
|
+
}
|
|
1835
|
+
var i = 0;
|
|
1836
|
+
var j = 0;
|
|
1837
|
+
var cipher = [];
|
|
1838
|
+
for(var k = 0; k < plaintext.length; k++){
|
|
1839
|
+
i = (i + 1) % 256;
|
|
1840
|
+
j = (j + s[i]) % 256;
|
|
1841
|
+
var temp = s[i];
|
|
1842
|
+
s[i] = s[j];
|
|
1843
|
+
s[j] = temp;
|
|
1844
|
+
var t = (s[i] + s[j]) % 256;
|
|
1845
|
+
cipher.push(String.fromCharCode(s[t] ^ plaintext.charCodeAt(k)));
|
|
1846
|
+
}
|
|
1847
|
+
return cipher.join('');
|
|
1848
|
+
}
|
|
1849
|
+
function le(e, r) {
|
|
1850
|
+
return (e << (r %= 32) | e >>> 32 - r) >>> 0;
|
|
1851
|
+
}
|
|
1852
|
+
function de(e) {
|
|
1853
|
+
return 0 <= e && e < 16 ? 2043430169 : 16 <= e && e < 64 ? 2055708042 : void console['error']("invalid j for constant Tj");
|
|
1854
|
+
}
|
|
1855
|
+
function pe(e, r, t, n) {
|
|
1856
|
+
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);
|
|
1857
|
+
}
|
|
1858
|
+
function he(e, r, t, n) {
|
|
1859
|
+
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);
|
|
1860
|
+
}
|
|
1861
|
+
function reset() {
|
|
1862
|
+
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;
|
|
1863
|
+
}
|
|
1864
|
+
function write(e) {
|
|
1865
|
+
var a = "string" == typeof e ? function(e) {
|
|
1866
|
+
var n = encodeURIComponent(e)['replace'](/%([0-9A-F]{2})/g, function(e, r) {
|
|
1867
|
+
return String['fromCharCode']("0x" + r);
|
|
1868
|
+
}), a = new Array(n['length']);
|
|
1869
|
+
return Array['prototype']['forEach']['call'](n, function(e, r) {
|
|
1870
|
+
a[r] = e.charCodeAt(0);
|
|
1871
|
+
}), a;
|
|
1872
|
+
}(e) : e;
|
|
1873
|
+
this.size += a.length;
|
|
1874
|
+
var f = 64 - this['chunk']['length'];
|
|
1875
|
+
if (a['length'] < f) this['chunk'] = this['chunk'].concat(a);
|
|
1876
|
+
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;
|
|
1877
|
+
}
|
|
1878
|
+
function sum(e, t) {
|
|
1879
|
+
e && (this['reset'](), this['write'](e)), this['_fill']();
|
|
1880
|
+
for(var f = 0; f < this.chunk['length']; f += 64)this._compress(this['chunk']['slice'](f, f + 64));
|
|
1881
|
+
var i = null;
|
|
1882
|
+
if ('hex' == t) {
|
|
1883
|
+
i = "";
|
|
1884
|
+
for(f = 0; f < 8; f++)i += se(this['reg'][f]['toString'](16), 8, "0");
|
|
1885
|
+
} else for(i = new Array(32), f = 0; f < 8; f++){
|
|
1886
|
+
var c = this.reg[f];
|
|
1887
|
+
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;
|
|
1888
|
+
}
|
|
1889
|
+
return this['reset'](), i;
|
|
1890
|
+
}
|
|
1891
|
+
function _compress(t) {
|
|
1892
|
+
if (t < 64) console.error("compress error: not enough data");
|
|
1893
|
+
else {
|
|
1894
|
+
for(var f = function(e) {
|
|
1895
|
+
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;
|
|
1896
|
+
for(var n = 16; n < 68; n++){
|
|
1897
|
+
var a = r[n - 16] ^ r[n - 9] ^ le(r[n - 3], 15);
|
|
1898
|
+
a = a ^ le(a, 15) ^ le(a, 23), r[n] = (a ^ le(r[n - 13], 7) ^ r[n - 6]) >>> 0;
|
|
1899
|
+
}
|
|
1900
|
+
for(n = 0; n < 64; n++)r[n + 68] = (r[n] ^ r[n + 4]) >>> 0;
|
|
1901
|
+
return r;
|
|
1902
|
+
}(t), i = this['reg'].slice(0), c = 0; c < 64; c++){
|
|
1903
|
+
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]);
|
|
1904
|
+
u = (4294967295 & (u = u + i[3] + s + f[c + 68])) >>> 0;
|
|
1905
|
+
var b = he(c, i[4], i[5], i[6]);
|
|
1906
|
+
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;
|
|
1907
|
+
}
|
|
1908
|
+
for(var l = 0; l < 8; l++)this['reg'][l] = (this['reg'][l] ^ i[l]) >>> 0;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function _fill() {
|
|
1912
|
+
var a = 8 * this['size'], f = this['chunk']['push'](128) % 64;
|
|
1913
|
+
for(64 - f < 8 && (f -= 64); f < 56; f++)this.chunk['push'](0);
|
|
1914
|
+
for(var i = 0; i < 4; i++){
|
|
1915
|
+
var c = Math['floor'](a / 4294967296);
|
|
1916
|
+
this['chunk'].push(c >>> 8 * (3 - i) & 255);
|
|
1917
|
+
}
|
|
1918
|
+
for(i = 0; i < 4; i++)this['chunk']['push'](a >>> 8 * (3 - i) & 255);
|
|
1919
|
+
}
|
|
1920
|
+
function SM3() {
|
|
1921
|
+
this.reg = [];
|
|
1922
|
+
this.chunk = [];
|
|
1923
|
+
this.size = 0;
|
|
1924
|
+
this.reset();
|
|
1925
|
+
}
|
|
1926
|
+
SM3.prototype.reset = reset;
|
|
1927
|
+
SM3.prototype.write = write;
|
|
1928
|
+
SM3.prototype.sum = sum;
|
|
1929
|
+
SM3.prototype._compress = _compress;
|
|
1930
|
+
SM3.prototype._fill = _fill;
|
|
1931
|
+
function result_encrypt(long_str, num = null) {
|
|
1932
|
+
let s_obj = {
|
|
1933
|
+
s0: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
1934
|
+
s1: "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
1935
|
+
s2: "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
|
|
1936
|
+
s3: "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
|
|
1937
|
+
s4: "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe"
|
|
1938
|
+
};
|
|
1939
|
+
let constant = {
|
|
1940
|
+
0: 16515072,
|
|
1941
|
+
1: 258048,
|
|
1942
|
+
2: 4032,
|
|
1943
|
+
str: s_obj[num]
|
|
1944
|
+
};
|
|
1945
|
+
let result = "";
|
|
1946
|
+
let lound = 0;
|
|
1947
|
+
let long_int = get_long_int(lound, long_str);
|
|
1948
|
+
for(let i = 0; i < long_str.length / 3 * 4; i++){
|
|
1949
|
+
if (Math.floor(i / 4) !== lound) {
|
|
1950
|
+
lound += 1;
|
|
1951
|
+
long_int = get_long_int(lound, long_str);
|
|
1952
|
+
}
|
|
1953
|
+
let key = i % 4;
|
|
1954
|
+
let temp_int = 0;
|
|
1955
|
+
switch(key){
|
|
1956
|
+
case 0:
|
|
1957
|
+
temp_int = (long_int & constant["0"]) >> 18;
|
|
1958
|
+
result += constant["str"].charAt(temp_int);
|
|
1959
|
+
break;
|
|
1960
|
+
case 1:
|
|
1961
|
+
temp_int = (long_int & constant["1"]) >> 12;
|
|
1962
|
+
result += constant["str"].charAt(temp_int);
|
|
1963
|
+
break;
|
|
1964
|
+
case 2:
|
|
1965
|
+
temp_int = (long_int & constant["2"]) >> 6;
|
|
1966
|
+
result += constant["str"].charAt(temp_int);
|
|
1967
|
+
break;
|
|
1968
|
+
case 3:
|
|
1969
|
+
temp_int = 63 & long_int;
|
|
1970
|
+
result += constant["str"].charAt(temp_int);
|
|
1971
|
+
break;
|
|
1972
|
+
default:
|
|
1973
|
+
break;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
return result;
|
|
1977
|
+
}
|
|
1978
|
+
function get_long_int(round, long_str) {
|
|
1979
|
+
round *= 3;
|
|
1980
|
+
return long_str.charCodeAt(round) << 16 | long_str.charCodeAt(round + 1) << 8 | long_str.charCodeAt(round + 2);
|
|
1981
|
+
}
|
|
1982
|
+
function gener_random(random, option) {
|
|
1983
|
+
return [
|
|
1984
|
+
170 & random | 85 & option[0],
|
|
1985
|
+
85 & random | 170 & option[0],
|
|
1986
|
+
random >> 8 & 170 | 85 & option[1],
|
|
1987
|
+
random >> 8 & 85 | 170 & option[1]
|
|
1988
|
+
];
|
|
1989
|
+
}
|
|
1990
|
+
function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suffix = "cus", Arguments = [
|
|
1991
|
+
0,
|
|
1992
|
+
1,
|
|
1993
|
+
14
|
|
1994
|
+
]) {
|
|
1995
|
+
let sm3 = new SM3();
|
|
1996
|
+
let start_time = Date.now();
|
|
1997
|
+
let url_search_params_list = sm3.sum(sm3.sum(url_search_params + suffix));
|
|
1998
|
+
let cus = sm3.sum(sm3.sum(suffix));
|
|
1999
|
+
let ua = sm3.sum(result_encrypt(rc4_encrypt(user_agent, String.fromCharCode.apply(null, [
|
|
2000
|
+
0.00390625,
|
|
2001
|
+
1,
|
|
2002
|
+
Arguments[2]
|
|
2003
|
+
])), "s3"));
|
|
2004
|
+
let end_time = Date.now();
|
|
2005
|
+
let b = {
|
|
2006
|
+
8: 3,
|
|
2007
|
+
10: end_time,
|
|
2008
|
+
15: {
|
|
2009
|
+
aid: 6383,
|
|
2010
|
+
pageId: 6241,
|
|
2011
|
+
boe: false,
|
|
2012
|
+
ddrt: 7,
|
|
2013
|
+
paths: {
|
|
2014
|
+
include: [
|
|
2015
|
+
{},
|
|
2016
|
+
{},
|
|
2017
|
+
{},
|
|
2018
|
+
{},
|
|
2019
|
+
{},
|
|
2020
|
+
{},
|
|
2021
|
+
{}
|
|
2022
|
+
],
|
|
2023
|
+
exclude: []
|
|
2024
|
+
},
|
|
2025
|
+
track: {
|
|
2026
|
+
mode: 0,
|
|
2027
|
+
delay: 300,
|
|
2028
|
+
paths: []
|
|
2029
|
+
},
|
|
2030
|
+
dump: true,
|
|
2031
|
+
rpU: ""
|
|
2032
|
+
},
|
|
2033
|
+
16: start_time,
|
|
2034
|
+
18: 44,
|
|
2035
|
+
19: [
|
|
2036
|
+
1,
|
|
2037
|
+
0,
|
|
2038
|
+
1,
|
|
2039
|
+
5
|
|
2040
|
+
]
|
|
2041
|
+
};
|
|
2042
|
+
b[20] = b[16] >> 24 & 255;
|
|
2043
|
+
b[21] = b[16] >> 16 & 255;
|
|
2044
|
+
b[22] = b[16] >> 8 & 255;
|
|
2045
|
+
b[23] = 255 & b[16];
|
|
2046
|
+
b[24] = b[16] / 256 / 256 / 256 / 256 >> 0;
|
|
2047
|
+
b[25] = b[16] / 256 / 256 / 256 / 256 / 256 >> 0;
|
|
2048
|
+
b[26] = Arguments[0] >> 24 & 255;
|
|
2049
|
+
b[27] = Arguments[0] >> 16 & 255;
|
|
2050
|
+
b[28] = Arguments[0] >> 8 & 255;
|
|
2051
|
+
b[29] = 255 & Arguments[0];
|
|
2052
|
+
b[30] = Arguments[1] / 256 & 255;
|
|
2053
|
+
b[31] = Arguments[1] % 256 & 255;
|
|
2054
|
+
b[32] = Arguments[1] >> 24 & 255;
|
|
2055
|
+
b[33] = Arguments[1] >> 16 & 255;
|
|
2056
|
+
b[34] = Arguments[2] >> 24 & 255;
|
|
2057
|
+
b[35] = Arguments[2] >> 16 & 255;
|
|
2058
|
+
b[36] = Arguments[2] >> 8 & 255;
|
|
2059
|
+
b[37] = 255 & Arguments[2];
|
|
2060
|
+
b[38] = url_search_params_list[21];
|
|
2061
|
+
b[39] = url_search_params_list[22];
|
|
2062
|
+
b[40] = cus[21];
|
|
2063
|
+
b[41] = cus[22];
|
|
2064
|
+
b[42] = ua[23];
|
|
2065
|
+
b[43] = ua[24];
|
|
2066
|
+
b[44] = b[10] >> 24 & 255;
|
|
2067
|
+
b[45] = b[10] >> 16 & 255;
|
|
2068
|
+
b[46] = b[10] >> 8 & 255;
|
|
2069
|
+
b[47] = 255 & b[10];
|
|
2070
|
+
b[48] = b[8];
|
|
2071
|
+
b[49] = b[10] / 256 / 256 / 256 / 256 >> 0;
|
|
2072
|
+
b[50] = b[10] / 256 / 256 / 256 / 256 / 256 >> 0;
|
|
2073
|
+
b[51] = b[15]['pageId'];
|
|
2074
|
+
b[52] = b[15]['pageId'] >> 24 & 255;
|
|
2075
|
+
b[53] = b[15]['pageId'] >> 16 & 255;
|
|
2076
|
+
b[54] = b[15]['pageId'] >> 8 & 255;
|
|
2077
|
+
b[55] = 255 & b[15]['pageId'];
|
|
2078
|
+
b[56] = b[15]['aid'];
|
|
2079
|
+
b[57] = 255 & b[15]['aid'];
|
|
2080
|
+
b[58] = b[15]['aid'] >> 8 & 255;
|
|
2081
|
+
b[59] = b[15]['aid'] >> 16 & 255;
|
|
2082
|
+
b[60] = b[15]['aid'] >> 24 & 255;
|
|
2083
|
+
let window_env_list = [];
|
|
2084
|
+
for(let index = 0; index < window_env_str.length; index++)window_env_list.push(window_env_str.charCodeAt(index));
|
|
2085
|
+
b[64] = window_env_list.length;
|
|
2086
|
+
b[65] = 255 & b[64];
|
|
2087
|
+
b[66] = b[64] >> 8 & 255;
|
|
2088
|
+
b[69] = 0;
|
|
2089
|
+
b[70] = 255 & b[69];
|
|
2090
|
+
b[71] = b[69] >> 8 & 255;
|
|
2091
|
+
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];
|
|
2092
|
+
let bb = [
|
|
2093
|
+
b[18],
|
|
2094
|
+
b[20],
|
|
2095
|
+
b[52],
|
|
2096
|
+
b[26],
|
|
2097
|
+
b[30],
|
|
2098
|
+
b[34],
|
|
2099
|
+
b[58],
|
|
2100
|
+
b[38],
|
|
2101
|
+
b[40],
|
|
2102
|
+
b[53],
|
|
2103
|
+
b[42],
|
|
2104
|
+
b[21],
|
|
2105
|
+
b[27],
|
|
2106
|
+
b[54],
|
|
2107
|
+
b[55],
|
|
2108
|
+
b[31],
|
|
2109
|
+
b[35],
|
|
2110
|
+
b[57],
|
|
2111
|
+
b[39],
|
|
2112
|
+
b[41],
|
|
2113
|
+
b[43],
|
|
2114
|
+
b[22],
|
|
2115
|
+
b[28],
|
|
2116
|
+
b[32],
|
|
2117
|
+
b[60],
|
|
2118
|
+
b[36],
|
|
2119
|
+
b[23],
|
|
2120
|
+
b[29],
|
|
2121
|
+
b[33],
|
|
2122
|
+
b[37],
|
|
2123
|
+
b[44],
|
|
2124
|
+
b[45],
|
|
2125
|
+
b[59],
|
|
2126
|
+
b[46],
|
|
2127
|
+
b[47],
|
|
2128
|
+
b[48],
|
|
2129
|
+
b[49],
|
|
2130
|
+
b[50],
|
|
2131
|
+
b[24],
|
|
2132
|
+
b[25],
|
|
2133
|
+
b[65],
|
|
2134
|
+
b[66],
|
|
2135
|
+
b[70],
|
|
2136
|
+
b[71]
|
|
2137
|
+
];
|
|
2138
|
+
bb = bb.concat(window_env_list).concat(b[72]);
|
|
2139
|
+
return rc4_encrypt(String.fromCharCode.apply(null, bb), String.fromCharCode.apply(null, [
|
|
2140
|
+
121
|
|
2141
|
+
]));
|
|
2142
|
+
}
|
|
2143
|
+
function generate_random_str() {
|
|
2144
|
+
let random_str_list = [];
|
|
2145
|
+
random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
|
|
2146
|
+
3,
|
|
2147
|
+
45
|
|
2148
|
+
]));
|
|
2149
|
+
random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
|
|
2150
|
+
1,
|
|
2151
|
+
0
|
|
2152
|
+
]));
|
|
2153
|
+
random_str_list = random_str_list.concat(gener_random(10000 * Math.random(), [
|
|
2154
|
+
1,
|
|
2155
|
+
5
|
|
2156
|
+
]));
|
|
2157
|
+
return String.fromCharCode.apply(null, random_str_list);
|
|
2158
|
+
}
|
|
2159
|
+
function sign(url_search_params, user_agent, arr) {
|
|
2160
|
+
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);
|
|
2161
|
+
return result_encrypt(result_str, "s4") + "=";
|
|
2162
|
+
}
|
|
2163
|
+
function sign_datail(params, userAgent) {
|
|
2164
|
+
return sign(params, userAgent, [
|
|
2165
|
+
0,
|
|
2166
|
+
1,
|
|
2167
|
+
14
|
|
2168
|
+
]);
|
|
2169
|
+
}
|
|
2170
|
+
function sign_reply(params, userAgent) {
|
|
2171
|
+
return sign(params, userAgent, [
|
|
2172
|
+
0,
|
|
2173
|
+
1,
|
|
2174
|
+
8
|
|
2175
|
+
]);
|
|
2176
|
+
}
|
|
2177
|
+
},
|
|
2178
|
+
"./src/utils/douyin/douyinSign.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2179
|
+
"use strict";
|
|
2180
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2181
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2182
|
+
calculateFileCrc32: ()=>calculateFileCrc32,
|
|
2183
|
+
canonicalQueryString: ()=>canonicalQueryString,
|
|
2184
|
+
generateAuthorization: ()=>generateAuthorization,
|
|
2185
|
+
randomS: ()=>randomS
|
|
2186
|
+
});
|
|
2187
|
+
const crypto = __webpack_require__("crypto");
|
|
2188
|
+
const UNSIGNABLE_HEADERS = [
|
|
2189
|
+
'authorization',
|
|
2190
|
+
'content-type',
|
|
2191
|
+
'content-length',
|
|
2192
|
+
'user-agent',
|
|
2193
|
+
'presigned-expires',
|
|
2194
|
+
'expect',
|
|
2195
|
+
'x-amzn-trace-id'
|
|
2196
|
+
];
|
|
2197
|
+
function sha256(data) {
|
|
2198
|
+
return crypto.createHash('sha256').update(data, 'utf8').digest('hex');
|
|
2199
|
+
}
|
|
2200
|
+
function hmac(key, data) {
|
|
2201
|
+
return crypto.createHmac('sha256', key).update(data, 'utf8').digest();
|
|
2202
|
+
}
|
|
2203
|
+
function getSigningKey(secretAccessKey, dateStamp, region, service) {
|
|
2204
|
+
const kDate = hmac('AWS4' + secretAccessKey, dateStamp);
|
|
2205
|
+
const kRegion = hmac(kDate, region);
|
|
2206
|
+
const kService = hmac(kRegion, service);
|
|
2207
|
+
const kSigning = hmac(kService, 'aws4_request');
|
|
2208
|
+
return kSigning;
|
|
2209
|
+
}
|
|
2210
|
+
function isSignableHeader(header) {
|
|
2211
|
+
const lowerHeader = header.toLowerCase();
|
|
2212
|
+
return lowerHeader.startsWith('x-amz-') || !UNSIGNABLE_HEADERS.includes(lowerHeader);
|
|
2213
|
+
}
|
|
2214
|
+
function canonicalHeaderValues(value) {
|
|
2215
|
+
return value.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
|
|
2216
|
+
}
|
|
2217
|
+
function canonicalHeaders(headers) {
|
|
2218
|
+
const headerPairs = [];
|
|
2219
|
+
Object.keys(headers).forEach((key)=>{
|
|
2220
|
+
headerPairs.push([
|
|
2221
|
+
key,
|
|
2222
|
+
headers[key]
|
|
2223
|
+
]);
|
|
2224
|
+
});
|
|
2225
|
+
headerPairs.sort((a, b)=>a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1);
|
|
2226
|
+
const result = [];
|
|
2227
|
+
headerPairs.forEach(([key, value])=>{
|
|
2228
|
+
const lowerKey = key.toLowerCase();
|
|
2229
|
+
if (isSignableHeader(lowerKey)) result.push(`${lowerKey}:${canonicalHeaderValues(value.toString())}`);
|
|
2230
|
+
});
|
|
2231
|
+
return result.join('\n');
|
|
2232
|
+
}
|
|
2233
|
+
function signedHeaders(headers) {
|
|
2234
|
+
const headerNames = [];
|
|
2235
|
+
Object.keys(headers).forEach((key)=>{
|
|
2236
|
+
const lowerKey = key.toLowerCase();
|
|
2237
|
+
if (isSignableHeader(lowerKey)) headerNames.push(lowerKey);
|
|
2238
|
+
});
|
|
2239
|
+
return headerNames.sort().join(';');
|
|
2240
|
+
}
|
|
2241
|
+
function canonicalQueryString(params) {
|
|
2242
|
+
if (!params || 0 === Object.keys(params).length) return '';
|
|
2243
|
+
return Object.keys(params).sort().map((key)=>{
|
|
2244
|
+
const value = params[key];
|
|
2245
|
+
return encodeURIComponent(key) + '=' + encodeURIComponent(String(value));
|
|
2246
|
+
}).join('&');
|
|
2247
|
+
}
|
|
2248
|
+
function iso8601(date) {
|
|
2249
|
+
return date.toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
2250
|
+
}
|
|
2251
|
+
function randomS() {
|
|
2252
|
+
const pool = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
2253
|
+
let s = '';
|
|
2254
|
+
for(let i = 0; i < 11; i++)s += pool.charAt(Math.floor(Math.random() * pool.length));
|
|
2255
|
+
return s;
|
|
2256
|
+
}
|
|
2257
|
+
function generateAuthorization(config) {
|
|
2258
|
+
const { accessKeyId, secretAccessKey, sessionToken, region, service, method = 'GET', pathname = '/', params = {}, body = '', headers = {} } = config;
|
|
2259
|
+
const now = new Date();
|
|
2260
|
+
const amzDate = iso8601(now).replace(/[:\-]|\.\d{3}/g, '');
|
|
2261
|
+
const dateStamp = amzDate.substr(0, 8);
|
|
2262
|
+
const requestHeaders = {
|
|
2263
|
+
...headers,
|
|
2264
|
+
'X-Amz-Date': amzDate
|
|
2265
|
+
};
|
|
2266
|
+
if (sessionToken) requestHeaders['x-amz-security-token'] = sessionToken;
|
|
2267
|
+
if (body) requestHeaders['X-Amz-Content-Sha256'] = sha256(JSON.stringify(body));
|
|
2268
|
+
const canonicalQueryStr = canonicalQueryString(params);
|
|
2269
|
+
const canonicalHeadersStr = canonicalHeaders(requestHeaders);
|
|
2270
|
+
const signedHeadersStr = signedHeaders(requestHeaders);
|
|
2271
|
+
const payloadHash = body ? sha256(JSON.stringify(body)) : sha256('');
|
|
2272
|
+
const canonicalRequest = [
|
|
2273
|
+
method.toUpperCase(),
|
|
2274
|
+
pathname,
|
|
2275
|
+
canonicalQueryStr,
|
|
2276
|
+
canonicalHeadersStr + '\n',
|
|
2277
|
+
signedHeadersStr,
|
|
2278
|
+
payloadHash
|
|
2279
|
+
].join('\n');
|
|
2280
|
+
const algorithm = 'AWS4-HMAC-SHA256';
|
|
2281
|
+
const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
|
|
2282
|
+
const canonicalRequestHash = sha256(canonicalRequest);
|
|
2283
|
+
const stringToSign = [
|
|
2284
|
+
algorithm,
|
|
2285
|
+
amzDate,
|
|
2286
|
+
credentialScope,
|
|
2287
|
+
canonicalRequestHash
|
|
2288
|
+
].join('\n');
|
|
2289
|
+
const signingKey = getSigningKey(secretAccessKey, dateStamp, region, service);
|
|
2290
|
+
const signature = crypto.createHmac('sha256', signingKey).update(stringToSign, 'utf8').digest('hex');
|
|
2291
|
+
const authorization = `${algorithm} Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeadersStr}, Signature=${signature}`;
|
|
2292
|
+
return {
|
|
2293
|
+
authorization,
|
|
2294
|
+
headers: requestHeaders,
|
|
2295
|
+
amzDate
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
const fs = __webpack_require__("fs");
|
|
2299
|
+
function calculateFileCrc32(filePath) {
|
|
2300
|
+
const data = fs.readFileSync(filePath);
|
|
2301
|
+
const crc32Value = crc32(data);
|
|
2302
|
+
const crc32Hex = crc32Value.toString(16);
|
|
2303
|
+
return crc32Hex;
|
|
2304
|
+
}
|
|
2305
|
+
function crc32(data) {
|
|
2306
|
+
const CRC_TABLE = [];
|
|
2307
|
+
for(let i = 0; i < 256; i++){
|
|
2308
|
+
let crc = i;
|
|
2309
|
+
for(let j = 0; j < 8; j++)crc = 1 & crc ? 0xEDB88320 ^ crc >>> 1 : crc >>> 1;
|
|
2310
|
+
CRC_TABLE.push(crc >>> 0);
|
|
2311
|
+
}
|
|
2312
|
+
let crc = 0xFFFFFFFF;
|
|
2313
|
+
for(let i = 0; i < data.length; i++){
|
|
2314
|
+
const byte = data[i];
|
|
2315
|
+
const index = (crc ^ byte) & 0xFF;
|
|
2316
|
+
crc = (CRC_TABLE[index] ^ crc >>> 8) >>> 0;
|
|
2317
|
+
}
|
|
2318
|
+
crc = (0xFFFFFFFF ^ crc) >>> 0;
|
|
2319
|
+
return crc;
|
|
2320
|
+
}
|
|
2321
|
+
},
|
|
2322
|
+
"./src/utils/douyin/reqSign.js.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2323
|
+
const crypto = __webpack_require__("crypto");
|
|
2324
|
+
function bufferToHex(buffer) {
|
|
2325
|
+
return buffer.toString('hex');
|
|
2326
|
+
}
|
|
2327
|
+
function generateReqSign(privateKeyPem, data) {
|
|
2328
|
+
try {
|
|
2329
|
+
const privateKey = crypto.createPrivateKey({
|
|
2330
|
+
key: privateKeyPem,
|
|
2331
|
+
format: 'pem',
|
|
2332
|
+
type: 'pkcs8'
|
|
2333
|
+
});
|
|
2334
|
+
const dataBuffer = Buffer.from(data, 'utf8');
|
|
2335
|
+
const signature = crypto.sign('sha256', dataBuffer, {
|
|
2336
|
+
key: privateKey,
|
|
2337
|
+
dsaEncoding: 'der'
|
|
2338
|
+
});
|
|
2339
|
+
return bufferToHex(signature);
|
|
2340
|
+
} catch (error) {
|
|
2341
|
+
console.error('req_sign 生成失败:', error);
|
|
2342
|
+
throw error;
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
function generateReqSignFromTicket(ticket, privateKeyPem) {
|
|
2346
|
+
return generateReqSign(privateKeyPem, ticket);
|
|
2347
|
+
}
|
|
2348
|
+
function generateReqSignFromSignData(signData, privateKeyPem) {
|
|
2349
|
+
return generateReqSign(privateKeyPem, signData);
|
|
2350
|
+
}
|
|
2351
|
+
module.exports = {
|
|
2352
|
+
generateReqSign,
|
|
2353
|
+
generateReqSignFromTicket,
|
|
2354
|
+
generateReqSignFromSignData
|
|
2355
|
+
};
|
|
2356
|
+
},
|
|
1723
2357
|
"./src/utils/ttABEncrypt.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1724
2358
|
module = __webpack_require__.nmd(module);
|
|
1725
2359
|
const a0_0x45db08 = a0_0x4b0d;
|
|
@@ -4221,6 +4855,14 @@ var __webpack_modules__ = {
|
|
|
4221
4855
|
"use strict";
|
|
4222
4856
|
module.exports = require("assert");
|
|
4223
4857
|
},
|
|
4858
|
+
crypto: function(module) {
|
|
4859
|
+
"use strict";
|
|
4860
|
+
module.exports = require("crypto");
|
|
4861
|
+
},
|
|
4862
|
+
fs: function(module) {
|
|
4863
|
+
"use strict";
|
|
4864
|
+
module.exports = require("fs");
|
|
4865
|
+
},
|
|
4224
4866
|
http: function(module) {
|
|
4225
4867
|
"use strict";
|
|
4226
4868
|
module.exports = require("http");
|
|
@@ -4315,16 +4957,28 @@ var __webpack_exports__ = {};
|
|
|
4315
4957
|
"use strict";
|
|
4316
4958
|
__webpack_require__.r(__webpack_exports__);
|
|
4317
4959
|
__webpack_require__.d(__webpack_exports__, {
|
|
4318
|
-
|
|
4319
|
-
SearchAccountInfoParamsSchema: ()=>SearchAccountInfoParamsSchema,
|
|
4960
|
+
DouyinGetMusicByCategoryParamsSchema: ()=>DouyinGetMusicByCategoryParamsSchema,
|
|
4320
4961
|
rpaAction_Server_Mock: ()=>rpaAction_Server_Mock,
|
|
4321
4962
|
ConfigDataSchema: ()=>ConfigDataSchema,
|
|
4322
4963
|
XhsWebSearchParamsSchema: ()=>XhsWebSearchParamsSchema,
|
|
4323
4964
|
ttConfigDataSchema: ()=>ttConfigDataSchema,
|
|
4324
4965
|
getFileState: ()=>getFileState,
|
|
4966
|
+
DouyinPublishParamsSchema: ()=>DouyinPublishParamsSchema,
|
|
4967
|
+
DouyinGetMusicCategoryParamsSchema: ()=>DouyinGetMusicCategoryParamsSchema,
|
|
4325
4968
|
xhsConfigDataSchema: ()=>xhsConfigDataSchema,
|
|
4326
|
-
UnreadCountSchema: ()=>UnreadCountSchema,
|
|
4327
4969
|
SessionCheckResultSchema: ()=>SessionCheckResultSchema,
|
|
4970
|
+
DouyinGetHotParamsSchema: ()=>DouyinGetHotParamsSchema,
|
|
4971
|
+
DouyinGetMusicParamsSchema: ()=>DouyinGetMusicParamsSchema,
|
|
4972
|
+
FetchArticlesDataSchema: ()=>FetchArticlesDataSchema,
|
|
4973
|
+
FetchArticlesParamsSchema: ()=>FetchArticlesParamsSchema,
|
|
4974
|
+
XiaohongshuPublishParamsSchema: ()=>XiaohongshuPublishParamsSchema,
|
|
4975
|
+
wxConfigDataSchema: ()=>wxConfigDataSchema,
|
|
4976
|
+
Http: ()=>Http,
|
|
4977
|
+
DouyinGetLocationParamsSchema: ()=>DouyinGetLocationParamsSchema,
|
|
4978
|
+
SearchAccountInfoParamsSchema: ()=>SearchAccountInfoParamsSchema,
|
|
4979
|
+
DouyinGetCollectionParamsSchema: ()=>DouyinGetCollectionParamsSchema,
|
|
4980
|
+
DouyinGetTopicsParamsSchema: ()=>DouyinGetTopicsParamsSchema,
|
|
4981
|
+
UnreadCountSchema: ()=>UnreadCountSchema,
|
|
4328
4982
|
ActionCommonParamsSchema: ()=>ActionCommonParamsSchema,
|
|
4329
4983
|
ToutiaoPublishParamsSchema: ()=>ToutiaoPublishParamsSchema,
|
|
4330
4984
|
WeixinPublishParamsSchema: ()=>WeixinPublishParamsSchema,
|
|
@@ -4333,17 +4987,13 @@ var __webpack_exports__ = {};
|
|
|
4333
4987
|
BetaFlag: ()=>BetaFlag,
|
|
4334
4988
|
bjhConfigDataSchema: ()=>bjhConfigDataSchema,
|
|
4335
4989
|
BaijiahaoPublishParamsSchema: ()=>BaijiahaoPublishParamsSchema,
|
|
4336
|
-
FetchArticlesDataSchema: ()=>FetchArticlesDataSchema,
|
|
4337
|
-
FetchArticlesParamsSchema: ()=>FetchArticlesParamsSchema,
|
|
4338
|
-
Action: ()=>Action,
|
|
4339
|
-
ProxyAgent: ()=>ProxyAgent,
|
|
4340
|
-
XiaohongshuPublishParamsSchema: ()=>XiaohongshuPublishParamsSchema,
|
|
4341
4990
|
version: ()=>package_namespaceObject.i8,
|
|
4342
|
-
|
|
4991
|
+
Action: ()=>Action,
|
|
4992
|
+
ProxyAgent: ()=>ProxyAgent
|
|
4343
4993
|
});
|
|
4344
4994
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4345
4995
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4346
|
-
var package_namespaceObject = JSON.parse('{"i8":"
|
|
4996
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.1"}');
|
|
4347
4997
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4348
4998
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4349
4999
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -10533,77 +11183,605 @@ var __webpack_exports__ = {};
|
|
|
10533
11183
|
};
|
|
10534
11184
|
return (0, share_namespaceObject.success)(data, message);
|
|
10535
11185
|
};
|
|
10536
|
-
const
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
const args = [
|
|
10544
|
-
params.localIP,
|
|
10545
|
-
params.proxyLoc,
|
|
10546
|
-
params.accountId
|
|
10547
|
-
];
|
|
10548
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
10549
|
-
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
10550
|
-
logger: task.logger
|
|
10551
|
-
});
|
|
10552
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
10553
|
-
task.logger?.info("==> 代理信息获取成功!");
|
|
10554
|
-
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
10555
|
-
}
|
|
10556
|
-
const page = await task.createPage({
|
|
10557
|
-
url: "https://creator.douyin.com/",
|
|
10558
|
-
proxyUrl,
|
|
10559
|
-
userAgent: params.userAgent,
|
|
10560
|
-
...params.viewport ? {
|
|
10561
|
-
viewport: params.viewport
|
|
10562
|
-
} : {}
|
|
10563
|
-
});
|
|
10564
|
-
await page.route("**/*.mp4", (route)=>route.abort());
|
|
10565
|
-
await page.route("**/*.png", (route)=>route.abort());
|
|
10566
|
-
await page.route("**/*.ttf", (route)=>route.abort());
|
|
10567
|
-
await page.addInitScript(()=>{
|
|
10568
|
-
window.requestAnimationFrame = ()=>0;
|
|
10569
|
-
});
|
|
10570
|
-
task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
|
|
10571
|
-
await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
|
|
10572
|
-
timeout: 15000
|
|
11186
|
+
const DySessionCheck = async (_task, params)=>{
|
|
11187
|
+
const http = new Http({
|
|
11188
|
+
headers: {
|
|
11189
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11190
|
+
referer: "https://creator.douyin.com/",
|
|
11191
|
+
"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"
|
|
11192
|
+
}
|
|
10573
11193
|
});
|
|
10574
|
-
await
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
11194
|
+
const res = await http.api({
|
|
11195
|
+
method: "get",
|
|
11196
|
+
url: "https://creator.douyin.com/aweme/v1/creator/user/info/",
|
|
11197
|
+
params: {
|
|
11198
|
+
_ts: Date.now()
|
|
11199
|
+
},
|
|
11200
|
+
defaultErrorMsg: "抖音登录状态失效。"
|
|
10578
11201
|
});
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
11202
|
+
const isSuccess = 0 === res.status_code;
|
|
11203
|
+
const message = "抖音账号有效性检测成功";
|
|
11204
|
+
const data = isSuccess ? {
|
|
11205
|
+
isValidSession: true
|
|
11206
|
+
} : {
|
|
11207
|
+
isValidSession: false
|
|
11208
|
+
};
|
|
11209
|
+
return (0, share_namespaceObject.success)(data, message);
|
|
11210
|
+
};
|
|
11211
|
+
const DouyinGetCollectionParamsSchema = ActionCommonParamsSchema.extend({
|
|
11212
|
+
keyword: schemas_string().optional(),
|
|
11213
|
+
count: schemas_number().optional()
|
|
11214
|
+
});
|
|
11215
|
+
const { sign_datail, sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11216
|
+
const douyinGetCollection = async (_task, params)=>{
|
|
11217
|
+
const headers = {
|
|
11218
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11219
|
+
referer: "https://creator.douyin.com/",
|
|
11220
|
+
origin: "https://creator.douyin.com/"
|
|
11221
|
+
};
|
|
11222
|
+
const args = [
|
|
11223
|
+
{
|
|
11224
|
+
headers
|
|
11225
|
+
},
|
|
11226
|
+
_task.logger,
|
|
11227
|
+
params.proxyLoc,
|
|
11228
|
+
params.localIP,
|
|
11229
|
+
params.accountId
|
|
11230
|
+
];
|
|
11231
|
+
const http = new Http(...args);
|
|
11232
|
+
const collectionParams = {
|
|
11233
|
+
status: "0,2",
|
|
11234
|
+
count: "50",
|
|
11235
|
+
cursor: "0",
|
|
11236
|
+
source: "collection_create",
|
|
11237
|
+
aid: "1128",
|
|
11238
|
+
cookie_enabled: "true",
|
|
11239
|
+
screen_width: "1920",
|
|
11240
|
+
screen_height: "1200",
|
|
11241
|
+
browser_language: "zh-CN",
|
|
11242
|
+
browser_platform: "Win32",
|
|
11243
|
+
browser_name: "Mozilla",
|
|
11244
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11245
|
+
browser_online: "true",
|
|
11246
|
+
timezone_name: "Asia/Shanghai",
|
|
11247
|
+
support_h265: "1",
|
|
11248
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
|
|
11249
|
+
a_bogus: ""
|
|
11250
|
+
};
|
|
11251
|
+
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");
|
|
11252
|
+
collectionParams.a_bogus = aBogus;
|
|
11253
|
+
const queryString = new URLSearchParams(collectionParams).toString();
|
|
11254
|
+
const res = await http.api({
|
|
11255
|
+
method: "get",
|
|
11256
|
+
url: `https://creator.douyin.com/web/api/mix/list/?${queryString}`,
|
|
11257
|
+
headers: {
|
|
11258
|
+
...headers,
|
|
11259
|
+
"Content-Type": "application/json"
|
|
11260
|
+
}
|
|
11261
|
+
}, {
|
|
11262
|
+
retries: 3,
|
|
11263
|
+
retryDelay: 20,
|
|
11264
|
+
timeout: 3000
|
|
10588
11265
|
});
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
11266
|
+
const isSuccess = 0 === res.status_code;
|
|
11267
|
+
const message = `抖音获取合集${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11268
|
+
const data = isSuccess ? {
|
|
11269
|
+
collections: res?.mix_list || [],
|
|
11270
|
+
total: res?.mix_list?.length || 0
|
|
11271
|
+
} : {
|
|
11272
|
+
collections: [],
|
|
11273
|
+
total: 0
|
|
11274
|
+
};
|
|
11275
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11276
|
+
};
|
|
11277
|
+
const DouyinGetHotParamsSchema = ActionCommonParamsSchema.extend({
|
|
11278
|
+
query: schemas_string().optional(),
|
|
11279
|
+
count: schemas_number().optional()
|
|
11280
|
+
});
|
|
11281
|
+
const { sign_datail: douyinGetHot_sign_datail, sign_reply: douyinGetHot_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11282
|
+
const douyinGetHot = async (_task, params)=>{
|
|
11283
|
+
const headers = {
|
|
11284
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11285
|
+
referer: "https://creator.douyin.com/",
|
|
11286
|
+
origin: "https://creator.douyin.com/"
|
|
11287
|
+
};
|
|
11288
|
+
const args = [
|
|
11289
|
+
{
|
|
11290
|
+
headers
|
|
11291
|
+
},
|
|
11292
|
+
_task.logger,
|
|
11293
|
+
params.proxyLoc,
|
|
11294
|
+
params.localIP,
|
|
11295
|
+
params.accountId
|
|
11296
|
+
];
|
|
11297
|
+
const http = new Http(...args);
|
|
11298
|
+
const hotParams = {
|
|
11299
|
+
query: params.query || "",
|
|
11300
|
+
count: "50",
|
|
11301
|
+
aid: "1128",
|
|
11302
|
+
cookie_enabled: "0",
|
|
11303
|
+
screen_width: "1920",
|
|
11304
|
+
screen_height: "1200",
|
|
11305
|
+
browser_language: "zh-CN",
|
|
11306
|
+
browser_platform: "Win32",
|
|
11307
|
+
browser_name: "Mozilla",
|
|
11308
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11309
|
+
browser_online: "true",
|
|
11310
|
+
timezone_name: "Asia/Shanghai",
|
|
11311
|
+
support_h265: "1",
|
|
11312
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
|
|
11313
|
+
a_bogus: ""
|
|
11314
|
+
};
|
|
11315
|
+
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");
|
|
11316
|
+
hotParams.a_bogus = aBogus;
|
|
11317
|
+
const queryString = new URLSearchParams(hotParams).toString();
|
|
11318
|
+
console.log("抖音获取热点参数:", queryString);
|
|
11319
|
+
const res = await http.api({
|
|
11320
|
+
method: "get",
|
|
11321
|
+
url: `https://creator.douyin.com/aweme/v1/hotspot/search/?${queryString}`,
|
|
11322
|
+
headers: {
|
|
11323
|
+
...headers,
|
|
11324
|
+
"Content-Type": "application/json"
|
|
11325
|
+
}
|
|
11326
|
+
}, {
|
|
11327
|
+
retries: 3,
|
|
11328
|
+
retryDelay: 20,
|
|
11329
|
+
timeout: 3000
|
|
10593
11330
|
});
|
|
10594
|
-
const
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
11331
|
+
const isSuccess = 0 === res.status_code;
|
|
11332
|
+
const message = `抖音获取热点${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11333
|
+
const data = isSuccess ? {
|
|
11334
|
+
hot: res?.sentences || [],
|
|
11335
|
+
total: res?.sentences?.length || 0
|
|
11336
|
+
} : {
|
|
11337
|
+
hot: [],
|
|
11338
|
+
total: 0
|
|
10598
11339
|
};
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
11340
|
+
console.log("抖音获取热点数据:", data);
|
|
11341
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11342
|
+
};
|
|
11343
|
+
const DouyinGetLocationParamsSchema = ActionCommonParamsSchema.extend({
|
|
11344
|
+
keyword: schemas_string().optional(),
|
|
11345
|
+
count: schemas_number().optional()
|
|
11346
|
+
});
|
|
11347
|
+
const { sign_datail: douyinGetLocation_sign_datail, sign_reply: douyinGetLocation_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11348
|
+
const douyinGetLocation = async (_task, params)=>{
|
|
11349
|
+
const headers = {
|
|
11350
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11351
|
+
referer: "https://creator.douyin.com/",
|
|
11352
|
+
origin: "https://creator.douyin.com/"
|
|
11353
|
+
};
|
|
11354
|
+
const args = [
|
|
11355
|
+
{
|
|
11356
|
+
headers
|
|
11357
|
+
},
|
|
11358
|
+
_task.logger,
|
|
11359
|
+
params.proxyLoc,
|
|
11360
|
+
params.localIP,
|
|
11361
|
+
params.accountId
|
|
11362
|
+
];
|
|
11363
|
+
const http = new Http(...args);
|
|
11364
|
+
const keyword = params.keyword || "";
|
|
11365
|
+
const locationParams = {
|
|
11366
|
+
count: "1",
|
|
11367
|
+
from_webapp: "1",
|
|
11368
|
+
get_current_loc: "1",
|
|
11369
|
+
is_image_album_style: "1",
|
|
11370
|
+
search_type: "0",
|
|
11371
|
+
poi_anchor_tab: "2",
|
|
11372
|
+
page: "1",
|
|
11373
|
+
keyword: keyword,
|
|
11374
|
+
poi_mode: "{}",
|
|
11375
|
+
load_interest_city_type: "0",
|
|
11376
|
+
aid: "1128",
|
|
11377
|
+
cookie_enabled: "true",
|
|
11378
|
+
screen_width: "1920",
|
|
11379
|
+
screen_height: "1200",
|
|
11380
|
+
browser_language: "zh-CN",
|
|
11381
|
+
browser_platform: "Win32",
|
|
11382
|
+
browser_name: "Mozilla",
|
|
11383
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11384
|
+
browser_online: "true",
|
|
11385
|
+
timezone_name: "Asia/Shanghai",
|
|
11386
|
+
support_h265: "1",
|
|
11387
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
|
|
11388
|
+
a_bogus: ""
|
|
11389
|
+
};
|
|
11390
|
+
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");
|
|
11391
|
+
locationParams.a_bogus = aBogus;
|
|
11392
|
+
const queryString = new URLSearchParams(locationParams).toString();
|
|
11393
|
+
const res = await http.api({
|
|
11394
|
+
method: "get",
|
|
11395
|
+
url: `https://creator.douyin.com/aweme/v1/life/video_api/search/poi/?${queryString}`,
|
|
11396
|
+
headers: {
|
|
11397
|
+
...headers,
|
|
11398
|
+
"Content-Type": "application/json"
|
|
11399
|
+
}
|
|
11400
|
+
}, {
|
|
11401
|
+
retries: 3,
|
|
11402
|
+
retryDelay: 20,
|
|
11403
|
+
timeout: 3000
|
|
11404
|
+
});
|
|
11405
|
+
console.log("抖音获取位置响应:", res);
|
|
11406
|
+
const isSuccess = 0 === res.status_code;
|
|
11407
|
+
const message = `抖音获取位置${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11408
|
+
let locations = [];
|
|
11409
|
+
if (isSuccess && res?.poi_list) {
|
|
11410
|
+
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;
|
|
11411
|
+
}
|
|
11412
|
+
const data = {
|
|
11413
|
+
locations,
|
|
11414
|
+
total: locations.length
|
|
11415
|
+
};
|
|
11416
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11417
|
+
};
|
|
11418
|
+
const DouyinGetMusicParamsSchema = ActionCommonParamsSchema.extend({
|
|
11419
|
+
keyword: schemas_string().optional(),
|
|
11420
|
+
count: schemas_number().optional()
|
|
11421
|
+
});
|
|
11422
|
+
const { sign_datail: douyinGetMusic_sign_datail, sign_reply: douyinGetMusic_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11423
|
+
const douyinGetMusic = async (_task, params)=>{
|
|
11424
|
+
const headers = {
|
|
11425
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11426
|
+
referer: "https://creator.douyin.com/",
|
|
11427
|
+
origin: "https://creator.douyin.com/"
|
|
11428
|
+
};
|
|
11429
|
+
const args = [
|
|
11430
|
+
{
|
|
11431
|
+
headers
|
|
11432
|
+
},
|
|
11433
|
+
_task.logger,
|
|
11434
|
+
params.proxyLoc,
|
|
11435
|
+
params.localIP,
|
|
11436
|
+
params.accountId
|
|
11437
|
+
];
|
|
11438
|
+
const http = new Http(...args);
|
|
11439
|
+
const keyword = params.keyword || "";
|
|
11440
|
+
const musicParams = {
|
|
11441
|
+
keyword: keyword || "11",
|
|
11442
|
+
search_source: "normal_search",
|
|
11443
|
+
cout: "20",
|
|
11444
|
+
aid: "1128",
|
|
11445
|
+
cursor: "0",
|
|
11446
|
+
cookie_enabled: "true",
|
|
11447
|
+
screen_width: "1920",
|
|
11448
|
+
screen_height: "1200",
|
|
11449
|
+
browser_language: "zh-CN",
|
|
11450
|
+
browser_platform: "Win32",
|
|
11451
|
+
browser_name: "Mozilla",
|
|
11452
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11453
|
+
browser_online: "true",
|
|
11454
|
+
timezone_name: "Asia/Shanghai",
|
|
11455
|
+
support_h265: "1",
|
|
11456
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
|
|
11457
|
+
a_bogus: ""
|
|
11458
|
+
};
|
|
11459
|
+
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");
|
|
11460
|
+
musicParams.a_bogus = aBogus;
|
|
11461
|
+
const queryString = new URLSearchParams(musicParams).toString();
|
|
11462
|
+
console.log("抖音获取音乐参数:", queryString);
|
|
11463
|
+
const authorizationParams = {
|
|
11464
|
+
aid: "1128",
|
|
11465
|
+
cookie_enabled: "true",
|
|
11466
|
+
screen_width: "1920",
|
|
11467
|
+
screen_height: "1200",
|
|
11468
|
+
browser_language: "zh-CN",
|
|
11469
|
+
browser_platform: "Win32",
|
|
11470
|
+
browser_name: "Mozilla",
|
|
11471
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11472
|
+
browser_online: "true",
|
|
11473
|
+
timezone_name: "Asia/Shanghai",
|
|
11474
|
+
support_h265: "1"
|
|
11475
|
+
};
|
|
11476
|
+
const authorizationQueryString = new URLSearchParams(authorizationParams).toString();
|
|
11477
|
+
const authorization = await http.api({
|
|
11478
|
+
method: "get",
|
|
11479
|
+
url: `https://creator.douyin.com/web/api/media/aweme/search/post/auth/?${authorizationQueryString}`,
|
|
11480
|
+
headers: {
|
|
11481
|
+
...headers,
|
|
11482
|
+
"Content-Type": "application/json"
|
|
11483
|
+
}
|
|
11484
|
+
}, {
|
|
11485
|
+
retries: 3,
|
|
11486
|
+
retryDelay: 20,
|
|
11487
|
+
timeout: 3000
|
|
11488
|
+
});
|
|
11489
|
+
if (0 !== authorization.status_code) return (0, share_namespaceObject.response)(414, authorization.status_msg, {
|
|
11490
|
+
music: [],
|
|
11491
|
+
total: 0
|
|
11492
|
+
});
|
|
11493
|
+
console.log("抖音获取音乐权限:", authorization);
|
|
11494
|
+
const res = await http.api({
|
|
11495
|
+
method: "get",
|
|
11496
|
+
url: `https://tsearch.amemv.com/openapi/aweme/v1/music/search/?${queryString}`,
|
|
11497
|
+
headers: {
|
|
11498
|
+
...headers,
|
|
11499
|
+
"agw-auth": authorization?.signature || "",
|
|
11500
|
+
"Content-Type": "application/json"
|
|
11501
|
+
}
|
|
11502
|
+
}, {
|
|
11503
|
+
retries: 3,
|
|
11504
|
+
retryDelay: 20,
|
|
11505
|
+
timeout: 3000
|
|
11506
|
+
});
|
|
11507
|
+
console.log("抖音获取音乐响应:", res);
|
|
11508
|
+
const isSuccess = 0 === res.status_code;
|
|
11509
|
+
const message = `抖音获取音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11510
|
+
const data = isSuccess ? {
|
|
11511
|
+
music: res?.music || [],
|
|
11512
|
+
total: res?.music?.length || 0
|
|
11513
|
+
} : {
|
|
11514
|
+
music: [],
|
|
11515
|
+
total: 0
|
|
11516
|
+
};
|
|
11517
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11518
|
+
};
|
|
11519
|
+
const DouyinGetMusicByCategoryParamsSchema = ActionCommonParamsSchema.extend({
|
|
11520
|
+
category_id: schemas_string().optional(),
|
|
11521
|
+
type: schemas_string().optional(),
|
|
11522
|
+
count: schemas_number().optional()
|
|
11523
|
+
});
|
|
11524
|
+
const { sign_datail: douyinGetMusicByCategory_sign_datail, sign_reply: douyinGetMusicByCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11525
|
+
const douyinGetMusicByCategory = async (_task, params)=>{
|
|
11526
|
+
const headers = {
|
|
11527
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11528
|
+
referer: "https://creator.douyin.com/",
|
|
11529
|
+
origin: "https://creator.douyin.com/"
|
|
11530
|
+
};
|
|
11531
|
+
const args = [
|
|
11532
|
+
{
|
|
11533
|
+
headers
|
|
11534
|
+
},
|
|
11535
|
+
_task.logger,
|
|
11536
|
+
params.proxyLoc,
|
|
11537
|
+
params.localIP,
|
|
11538
|
+
params.accountId
|
|
11539
|
+
];
|
|
11540
|
+
const http = new Http(...args);
|
|
11541
|
+
const collectionParams = {
|
|
11542
|
+
status: "0,2",
|
|
11543
|
+
count: params.count?.toString() || "20",
|
|
11544
|
+
cursor: "0",
|
|
11545
|
+
source: "collection_create",
|
|
11546
|
+
aid: "1128",
|
|
11547
|
+
cookie_enabled: "true",
|
|
11548
|
+
screen_width: "1920",
|
|
11549
|
+
screen_height: "1200",
|
|
11550
|
+
browser_language: "zh-CN",
|
|
11551
|
+
browser_platform: "Win32",
|
|
11552
|
+
browser_name: "Mozilla",
|
|
11553
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11554
|
+
browser_online: "true",
|
|
11555
|
+
timezone_name: "Asia/Shanghai",
|
|
11556
|
+
support_h265: "1",
|
|
11557
|
+
type: params.type || "",
|
|
11558
|
+
category_id: params.category_id || "",
|
|
11559
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
11560
|
+
a_bogus: ""
|
|
11561
|
+
};
|
|
11562
|
+
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");
|
|
11563
|
+
collectionParams.a_bogus = aBogus;
|
|
11564
|
+
const queryString = new URLSearchParams(collectionParams).toString();
|
|
11565
|
+
const res = await http.api({
|
|
11566
|
+
method: "get",
|
|
11567
|
+
url: `https://creator.douyin.com/web/api/media/music/list/?${queryString}`,
|
|
11568
|
+
headers: {
|
|
11569
|
+
...headers,
|
|
11570
|
+
"Content-Type": "application/json"
|
|
11571
|
+
}
|
|
11572
|
+
}, {
|
|
11573
|
+
retries: 3,
|
|
11574
|
+
retryDelay: 20,
|
|
11575
|
+
timeout: 3000
|
|
11576
|
+
});
|
|
11577
|
+
const isSuccess = 0 === res.status_code;
|
|
11578
|
+
const message = `抖音获取推荐音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11579
|
+
const data = isSuccess ? {
|
|
11580
|
+
songs: res?.songs || []
|
|
11581
|
+
} : {
|
|
11582
|
+
songs: []
|
|
11583
|
+
};
|
|
11584
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11585
|
+
};
|
|
11586
|
+
const { sign_datail: douyinGetMusicCategory_sign_datail, sign_reply: douyinGetMusicCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11587
|
+
const DouyinGetMusicCategoryParamsSchema = ActionCommonParamsSchema.extend({});
|
|
11588
|
+
const douyinGetMusicCategory = async (_task, params)=>{
|
|
11589
|
+
const headers = {
|
|
11590
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11591
|
+
referer: "https://creator.douyin.com/",
|
|
11592
|
+
origin: "https://creator.douyin.com/"
|
|
11593
|
+
};
|
|
11594
|
+
const args = [
|
|
11595
|
+
{
|
|
11596
|
+
headers
|
|
11597
|
+
},
|
|
11598
|
+
_task.logger,
|
|
11599
|
+
params.proxyLoc,
|
|
11600
|
+
params.localIP,
|
|
11601
|
+
params.accountId
|
|
11602
|
+
];
|
|
11603
|
+
const http = new Http(...args);
|
|
11604
|
+
const categoryParams = {
|
|
11605
|
+
status: "0,2",
|
|
11606
|
+
count: "50",
|
|
11607
|
+
cursor: "0",
|
|
11608
|
+
source: "collection_create",
|
|
11609
|
+
aid: "1128",
|
|
11610
|
+
cookie_enabled: "true",
|
|
11611
|
+
screen_width: "1920",
|
|
11612
|
+
screen_height: "1200",
|
|
11613
|
+
browser_language: "zh-CN",
|
|
11614
|
+
browser_platform: "Win32",
|
|
11615
|
+
browser_name: "Mozilla",
|
|
11616
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11617
|
+
browser_online: "true",
|
|
11618
|
+
timezone_name: "Asia/Shanghai",
|
|
11619
|
+
support_h265: "1",
|
|
11620
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
11621
|
+
a_bogus: ""
|
|
11622
|
+
};
|
|
11623
|
+
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");
|
|
11624
|
+
categoryParams.a_bogus = aBogus;
|
|
11625
|
+
const queryString = new URLSearchParams(categoryParams).toString();
|
|
11626
|
+
const res = await http.api({
|
|
11627
|
+
method: "get",
|
|
11628
|
+
url: `https://creator.douyin.com/web/api/media/music/category?${queryString}`,
|
|
11629
|
+
headers: {
|
|
11630
|
+
...headers,
|
|
11631
|
+
"Content-Type": "application/json"
|
|
11632
|
+
}
|
|
11633
|
+
}, {
|
|
11634
|
+
retries: 3,
|
|
11635
|
+
retryDelay: 20,
|
|
11636
|
+
timeout: 3000
|
|
11637
|
+
});
|
|
11638
|
+
const isSuccess = 0 === res.status_code;
|
|
11639
|
+
const message = `抖音获取音乐分类${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11640
|
+
const data = isSuccess ? {
|
|
11641
|
+
categorys: res?.categories || []
|
|
11642
|
+
} : {
|
|
11643
|
+
categorys: []
|
|
11644
|
+
};
|
|
11645
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11646
|
+
};
|
|
11647
|
+
const DouyinGetTopicsParamsSchema = ActionCommonParamsSchema.extend({
|
|
11648
|
+
keyword: schemas_string().optional(),
|
|
11649
|
+
count: schemas_number().optional()
|
|
11650
|
+
});
|
|
11651
|
+
const { sign_datail: douyinGetTopics_sign_datail, sign_reply: douyinGetTopics_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11652
|
+
const douyinGetTopics = async (_task, params)=>{
|
|
11653
|
+
const headers = {
|
|
11654
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11655
|
+
referer: "https://creator.douyin.com/",
|
|
11656
|
+
origin: "https://creator.douyin.com/"
|
|
11657
|
+
};
|
|
11658
|
+
const args = [
|
|
11659
|
+
{
|
|
11660
|
+
headers
|
|
11661
|
+
},
|
|
11662
|
+
_task.logger,
|
|
11663
|
+
params.proxyLoc,
|
|
11664
|
+
params.localIP,
|
|
11665
|
+
params.accountId
|
|
11666
|
+
];
|
|
11667
|
+
const http = new Http(...args);
|
|
11668
|
+
const keyword = params.keyword || "";
|
|
11669
|
+
const topicParams = {
|
|
11670
|
+
keyword: keyword,
|
|
11671
|
+
source: "challenge_create",
|
|
11672
|
+
aid: "2906",
|
|
11673
|
+
cookie_enabled: "0",
|
|
11674
|
+
screen_width: "1920",
|
|
11675
|
+
screen_height: "1200",
|
|
11676
|
+
browser_language: "zh-CN",
|
|
11677
|
+
browser_platform: "Win32",
|
|
11678
|
+
browser_name: "Mozilla",
|
|
11679
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
11680
|
+
browser_online: "true",
|
|
11681
|
+
timezone_name: "Asia/Shanghai",
|
|
11682
|
+
support_h265: "1",
|
|
11683
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "rWRQTO837CH1bajTIbvPAL9o1lpyzocwIToJZFtN61sBoeN_OJM2ykkGFhQxgq6OXOzn2XDML8Lvo829NxjGfQy00RLGJ2q9DMaPEhrgSVv9YklzRT1sT7R03XZ3I6_3y7D_m0wnjGszj8IBQq8EpTNk8B0S3YIbUGfnl_Za9VnS25CU7PygDEY=",
|
|
11684
|
+
a_bogus: ""
|
|
11685
|
+
};
|
|
11686
|
+
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");
|
|
11687
|
+
topicParams.a_bogus = aBogus;
|
|
11688
|
+
const queryString = new URLSearchParams(topicParams).toString();
|
|
11689
|
+
console.log("抖音获取话题参数:", queryString);
|
|
11690
|
+
const res = await http.api({
|
|
11691
|
+
method: "get",
|
|
11692
|
+
url: `https://creator.douyin.com/aweme/v1/search/challengesug/?${queryString}`,
|
|
11693
|
+
headers: {
|
|
11694
|
+
...headers,
|
|
11695
|
+
"Content-Type": "application/json"
|
|
11696
|
+
}
|
|
11697
|
+
}, {
|
|
11698
|
+
retries: 3,
|
|
11699
|
+
retryDelay: 20,
|
|
11700
|
+
timeout: 3000
|
|
11701
|
+
});
|
|
11702
|
+
console.log("抖音获取话题响应:", res);
|
|
11703
|
+
const isSuccess = 0 === res.status_code;
|
|
11704
|
+
const message = `抖音获取话题${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11705
|
+
const data = isSuccess ? {
|
|
11706
|
+
topics: res?.sug_list || [],
|
|
11707
|
+
total: res?.sug_list?.length || 0
|
|
11708
|
+
} : {
|
|
11709
|
+
topics: [],
|
|
11710
|
+
total: 0
|
|
11711
|
+
};
|
|
11712
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11713
|
+
};
|
|
11714
|
+
const douyinLogin_rpa_server_scanRetryMaxCount = 60;
|
|
11715
|
+
const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
|
|
11716
|
+
const rpa_server_rpaServer = async (task, params)=>{
|
|
11717
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
11718
|
+
let executionState;
|
|
11719
|
+
let proxyUrl;
|
|
11720
|
+
if (params.localIP) {
|
|
11721
|
+
const args = [
|
|
11722
|
+
params.localIP,
|
|
11723
|
+
params.proxyLoc,
|
|
11724
|
+
params.accountId
|
|
11725
|
+
];
|
|
11726
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
11727
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
11728
|
+
logger: task.logger
|
|
11729
|
+
});
|
|
11730
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
11731
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
11732
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
11733
|
+
}
|
|
11734
|
+
const page = await task.createPage({
|
|
11735
|
+
url: "https://creator.douyin.com/",
|
|
11736
|
+
proxyUrl,
|
|
11737
|
+
userAgent: params.userAgent,
|
|
11738
|
+
...params.viewport ? {
|
|
11739
|
+
viewport: params.viewport
|
|
11740
|
+
} : {}
|
|
11741
|
+
});
|
|
11742
|
+
await page.route("**/*.mp4", (route)=>route.abort());
|
|
11743
|
+
await page.route("**/*.png", (route)=>route.abort());
|
|
11744
|
+
await page.route("**/*.ttf", (route)=>route.abort());
|
|
11745
|
+
await page.addInitScript(()=>{
|
|
11746
|
+
window.requestAnimationFrame = ()=>0;
|
|
11747
|
+
});
|
|
11748
|
+
task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
|
|
11749
|
+
await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
|
|
11750
|
+
timeout: 15000
|
|
11751
|
+
});
|
|
11752
|
+
await page.waitForLoadState("networkidle");
|
|
11753
|
+
await page.goto("about:blank");
|
|
11754
|
+
await page.goBack({
|
|
11755
|
+
waitUntil: "domcontentloaded"
|
|
11756
|
+
});
|
|
11757
|
+
task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
|
|
11758
|
+
await page.locator(".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle").click();
|
|
11759
|
+
task.steelBrowser?.on("disconnected", async ()=>{
|
|
11760
|
+
const browserContext = task.steelBrowserContext;
|
|
11761
|
+
const browser = task.steelBrowser;
|
|
11762
|
+
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
11763
|
+
await page.close();
|
|
11764
|
+
if (browserContext) await browserContext.close();
|
|
11765
|
+
if (browser) await browser.close();
|
|
11766
|
+
});
|
|
11767
|
+
await updateTaskState?.({
|
|
11768
|
+
state: share_namespaceObject.TaskState.WAIT_SCAN,
|
|
11769
|
+
connectAddress: await task.steelConnector?.getLive(task.sessionId || ""),
|
|
11770
|
+
sessionId: task.sessionId
|
|
11771
|
+
});
|
|
11772
|
+
const userInfo = {
|
|
11773
|
+
uniqueId: "",
|
|
11774
|
+
avatar: "",
|
|
11775
|
+
name: ""
|
|
11776
|
+
};
|
|
11777
|
+
try {
|
|
11778
|
+
await new Promise((resolve, reject)=>{
|
|
11779
|
+
let finished = false;
|
|
11780
|
+
const timer = setTimeout(async ()=>{
|
|
11781
|
+
cleanup();
|
|
11782
|
+
executionState = types_ExecutionState.TIMEOUT;
|
|
11783
|
+
await updateTaskState?.({
|
|
11784
|
+
state: share_namespaceObject.TaskState.TIMEOUT,
|
|
10607
11785
|
error: "等待扫码登录超时"
|
|
10608
11786
|
});
|
|
10609
11787
|
resolve();
|
|
@@ -10732,21 +11910,42 @@ var __webpack_exports__ = {};
|
|
|
10732
11910
|
};
|
|
10733
11911
|
}
|
|
10734
11912
|
case types_ExecutionState.SUCCESS:
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
11913
|
+
{
|
|
11914
|
+
let securityData = {};
|
|
11915
|
+
try {
|
|
11916
|
+
securityData = await page.evaluate(()=>({
|
|
11917
|
+
"security-sdk/s_sdk_pri_key": localStorage.getItem("security-sdk/s_sdk_pri_key") || "",
|
|
11918
|
+
"security-sdk/s_sdk_pub_key": localStorage.getItem("security-sdk/s_sdk_pub_key") || "",
|
|
11919
|
+
"security-sdk/s_sdk_sign_data_key": localStorage.getItem("security-sdk/s_sdk_sign_data_key/web_protect") || ""
|
|
11920
|
+
}));
|
|
11921
|
+
task.logger.info("Security SDK 数据提取成功:", {
|
|
11922
|
+
"security-sdk/s_sdk_pri_key": !!securityData["security-sdk/s_sdk_pri_key"],
|
|
11923
|
+
"security-sdk/s_sdk_pub_key": !!securityData["security-sdk/s_sdk_pub_key"],
|
|
11924
|
+
"security-sdk/s_sdk_sign_data_key": !!securityData["security-sdk/s_sdk_sign_data_key"]
|
|
11925
|
+
});
|
|
11926
|
+
} catch (error) {
|
|
11927
|
+
task.logger.warn("提取 Security SDK 数据失败:", {
|
|
11928
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11929
|
+
});
|
|
10748
11930
|
}
|
|
10749
|
-
|
|
11931
|
+
await updateTaskState?.({
|
|
11932
|
+
state: share_namespaceObject.TaskState.SUCCESS,
|
|
11933
|
+
result: {
|
|
11934
|
+
cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
|
|
11935
|
+
...securityData,
|
|
11936
|
+
userInfo: userInfo
|
|
11937
|
+
}
|
|
11938
|
+
});
|
|
11939
|
+
return {
|
|
11940
|
+
code: 0,
|
|
11941
|
+
message: "成功",
|
|
11942
|
+
data: {
|
|
11943
|
+
cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
|
|
11944
|
+
...securityData,
|
|
11945
|
+
userInfo
|
|
11946
|
+
}
|
|
11947
|
+
};
|
|
11948
|
+
}
|
|
10750
11949
|
default:
|
|
10751
11950
|
return {
|
|
10752
11951
|
code: 500,
|
|
@@ -10760,6 +11959,472 @@ var __webpack_exports__ = {};
|
|
|
10760
11959
|
if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
|
|
10761
11960
|
return executeAction(rpa_server_rpaServer)(task, params);
|
|
10762
11961
|
};
|
|
11962
|
+
const { sign_reply: mock_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
11963
|
+
const { generateReqSignFromTicket } = __webpack_require__("./src/utils/douyin/reqSign.js.js");
|
|
11964
|
+
const { generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/csrfToken.js");
|
|
11965
|
+
const { generateAuthorization, randomS, canonicalQueryString, calculateFileCrc32 } = __webpack_require__("./src/utils/douyin/douyinSign.js");
|
|
11966
|
+
const mock_mockAction = async (task, params)=>{
|
|
11967
|
+
const tmpCachePath = task.getTmpPath();
|
|
11968
|
+
let bdTicketGuardClientDataV2 = params.cookies.find((e)=>"bd_ticket_guard_client_data" === e.name)?.value || "";
|
|
11969
|
+
if (!bdTicketGuardClientDataV2) return (0, share_namespaceObject.response)(400, "bdTicketGuardClientDataV2 不能为空", "");
|
|
11970
|
+
bdTicketGuardClientDataV2 = decodeURIComponent(bdTicketGuardClientDataV2);
|
|
11971
|
+
console.log("原始 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
|
|
11972
|
+
try {
|
|
11973
|
+
bdTicketGuardClientDataV2 = atob(bdTicketGuardClientDataV2);
|
|
11974
|
+
console.log("解码后 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
|
|
11975
|
+
} catch (error) {
|
|
11976
|
+
console.error("bdTicketGuardClientDataV2 解码失败:", error);
|
|
11977
|
+
return (0, share_namespaceObject.response)(500, "bdTicketGuardClientDataV2 解码失败", "");
|
|
11978
|
+
}
|
|
11979
|
+
let ree_public_key = "";
|
|
11980
|
+
let ts_sign = "";
|
|
11981
|
+
try {
|
|
11982
|
+
const parsed = JSON.parse(bdTicketGuardClientDataV2);
|
|
11983
|
+
ree_public_key = parsed.ree_public_key || "";
|
|
11984
|
+
ts_sign = parsed.ts_sign || "";
|
|
11985
|
+
} catch {}
|
|
11986
|
+
const privateKey = params["security-sdk/s_sdk_pri_key"]?.data || "";
|
|
11987
|
+
const publicKey = params["security-sdk/s_sdk_pub_key"]?.data || "";
|
|
11988
|
+
const signData = JSON.parse(params["security-sdk/s_sdk_sign_data_key/web_protect"]?.data || "{}");
|
|
11989
|
+
console.log("privateKey:", privateKey);
|
|
11990
|
+
console.log("publicKey:", publicKey);
|
|
11991
|
+
console.log("signData:", signData);
|
|
11992
|
+
let bdTicketGuardClientData = {
|
|
11993
|
+
ts_sign,
|
|
11994
|
+
req_content: "ticket,path,timestamp",
|
|
11995
|
+
timestamp: Math.floor(Date.now() / 1000),
|
|
11996
|
+
req_sign: generateReqSignFromTicket(signData.ticket, privateKey)
|
|
11997
|
+
};
|
|
11998
|
+
console.log("bdTicketGuardClientData:", bdTicketGuardClientData);
|
|
11999
|
+
bdTicketGuardClientData = btoa(JSON.stringify(bdTicketGuardClientData));
|
|
12000
|
+
const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
12001
|
+
if (!sessionidCookie) return {
|
|
12002
|
+
code: 414,
|
|
12003
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
12004
|
+
data: ""
|
|
12005
|
+
};
|
|
12006
|
+
const headers = {
|
|
12007
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
12008
|
+
origin: "https://creator.douyin.com",
|
|
12009
|
+
referer: "https://creator.douyin.com/",
|
|
12010
|
+
"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"
|
|
12011
|
+
};
|
|
12012
|
+
const publishParams = {
|
|
12013
|
+
read_aid: "2906",
|
|
12014
|
+
aid: "1128",
|
|
12015
|
+
cookie_enabled: "true",
|
|
12016
|
+
screen_width: "1920",
|
|
12017
|
+
screen_height: "1200",
|
|
12018
|
+
browser_language: "zh-CN",
|
|
12019
|
+
browser_platform: "Win32",
|
|
12020
|
+
browser_name: "Mozilla",
|
|
12021
|
+
browser_version: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
12022
|
+
browser_online: "true",
|
|
12023
|
+
timezone_name: "Asia/Shanghai",
|
|
12024
|
+
support_h265: "1",
|
|
12025
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
12026
|
+
a_bogus: ""
|
|
12027
|
+
};
|
|
12028
|
+
const publishData = {
|
|
12029
|
+
item: {
|
|
12030
|
+
common: {
|
|
12031
|
+
text: params.title || "32234。sdsadadasda",
|
|
12032
|
+
text_extra: '[{"start":0,"end":5,"hashtag_id":0,"hashtag_name":"","type":7},{"start":5,"end":6,"hashtag_id":0,"hashtag_name":"","type":8}]',
|
|
12033
|
+
activity: "[]",
|
|
12034
|
+
challenges: "[]",
|
|
12035
|
+
hashtag_source: "",
|
|
12036
|
+
mentions: "[]",
|
|
12037
|
+
music_id: "",
|
|
12038
|
+
music_end_time: 0,
|
|
12039
|
+
hot_sentence: "",
|
|
12040
|
+
visibility_type: 0,
|
|
12041
|
+
download: 0,
|
|
12042
|
+
timing: -1,
|
|
12043
|
+
media_type: 2,
|
|
12044
|
+
images: []
|
|
12045
|
+
},
|
|
12046
|
+
cover: {
|
|
12047
|
+
poster: ""
|
|
12048
|
+
},
|
|
12049
|
+
mix: {},
|
|
12050
|
+
anchor: {
|
|
12051
|
+
poi_name: "",
|
|
12052
|
+
poi_id: "",
|
|
12053
|
+
anchor_content: "{}"
|
|
12054
|
+
},
|
|
12055
|
+
declare: {
|
|
12056
|
+
user_declare_info: "{}"
|
|
12057
|
+
}
|
|
12058
|
+
}
|
|
12059
|
+
};
|
|
12060
|
+
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");
|
|
12061
|
+
publishParams.a_bogus = aBogus;
|
|
12062
|
+
const queryString = new URLSearchParams(publishParams).toString();
|
|
12063
|
+
const args = [
|
|
12064
|
+
{
|
|
12065
|
+
headers
|
|
12066
|
+
},
|
|
12067
|
+
task.logger,
|
|
12068
|
+
params.proxyLoc,
|
|
12069
|
+
params.localIP,
|
|
12070
|
+
params.accountId
|
|
12071
|
+
];
|
|
12072
|
+
const http = new Http({
|
|
12073
|
+
headers
|
|
12074
|
+
});
|
|
12075
|
+
const proxyHttp = new Http(...args);
|
|
12076
|
+
const uploadAuth = await proxyHttp.api({
|
|
12077
|
+
method: "get",
|
|
12078
|
+
url: `https://creator.douyin.com/web/api/media/upload/auth/v5/?${queryString}`,
|
|
12079
|
+
headers: {
|
|
12080
|
+
...headers,
|
|
12081
|
+
"Content-Type": "application/json"
|
|
12082
|
+
}
|
|
12083
|
+
}, {
|
|
12084
|
+
retries: 3,
|
|
12085
|
+
retryDelay: 20,
|
|
12086
|
+
timeout: 3000
|
|
12087
|
+
});
|
|
12088
|
+
if (!uploadAuth.auth) {
|
|
12089
|
+
console.log("uploadAuth", JSON.stringify(uploadAuth));
|
|
12090
|
+
return {
|
|
12091
|
+
code: 414,
|
|
12092
|
+
message: uploadAuth.status_msg || "获取上传权限失败",
|
|
12093
|
+
data: ""
|
|
12094
|
+
};
|
|
12095
|
+
}
|
|
12096
|
+
async function GetUploadAddr(imgUrl, isCover) {
|
|
12097
|
+
const auth = JSON.parse(uploadAuth.auth);
|
|
12098
|
+
const times = new Date();
|
|
12099
|
+
const amzDate = times.toISOString().replace(/\.\d{3}Z$/, "Z").replace(/[:-]/g, "");
|
|
12100
|
+
const region = "cn-north-1";
|
|
12101
|
+
const service = "imagex";
|
|
12102
|
+
const sessionToken = auth.SessionToken;
|
|
12103
|
+
const accessKeyID = auth.AccessKeyID;
|
|
12104
|
+
const secretAccessKey = auth.SecretAccessKey;
|
|
12105
|
+
const addrParamsConfig = {
|
|
12106
|
+
accessKeyId: accessKeyID,
|
|
12107
|
+
secretAccessKey: secretAccessKey,
|
|
12108
|
+
sessionToken: sessionToken,
|
|
12109
|
+
region: region,
|
|
12110
|
+
service: service,
|
|
12111
|
+
method: "GET",
|
|
12112
|
+
pathname: "/",
|
|
12113
|
+
params: {
|
|
12114
|
+
Action: "ApplyImageUpload",
|
|
12115
|
+
ServiceId: "jm8ajry58r",
|
|
12116
|
+
Version: "2018-08-01",
|
|
12117
|
+
app_id: "2906",
|
|
12118
|
+
s: randomS(),
|
|
12119
|
+
user_id: ""
|
|
12120
|
+
}
|
|
12121
|
+
};
|
|
12122
|
+
const result = generateAuthorization(addrParamsConfig).authorization;
|
|
12123
|
+
const addrParamsQueryString = canonicalQueryString(addrParamsConfig.params);
|
|
12124
|
+
const uploadAddr = await proxyHttp.api({
|
|
12125
|
+
method: "get",
|
|
12126
|
+
url: `https://imagex.bytedanceapi.com/?${addrParamsQueryString}`,
|
|
12127
|
+
headers: {
|
|
12128
|
+
...headers,
|
|
12129
|
+
Authorization: result,
|
|
12130
|
+
"Content-Type": "application/json",
|
|
12131
|
+
"X-amz-date": amzDate,
|
|
12132
|
+
"X-amz-security-token": sessionToken
|
|
12133
|
+
}
|
|
12134
|
+
}, {
|
|
12135
|
+
retries: 3,
|
|
12136
|
+
retryDelay: 20,
|
|
12137
|
+
timeout: 3000
|
|
12138
|
+
});
|
|
12139
|
+
if (!uploadAddr?.Result?.RequestId) return (0, share_namespaceObject.response)(500, "获取上传地址失败", "");
|
|
12140
|
+
const fileBuffer = external_node_fs_default().readFileSync(imgUrl);
|
|
12141
|
+
const uploadImgResp = await proxyHttp.api({
|
|
12142
|
+
method: "post",
|
|
12143
|
+
url: `https://tos-hl-x.snssdk.com/upload/v1/${uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri}`,
|
|
12144
|
+
headers: {
|
|
12145
|
+
...headers,
|
|
12146
|
+
Authorization: uploadAddr.Result.UploadAddress.StoreInfos[0].Auth,
|
|
12147
|
+
"Content-crc32": calculateFileCrc32(imgUrl),
|
|
12148
|
+
"Content-Type": "application/octet-stream"
|
|
12149
|
+
},
|
|
12150
|
+
data: fileBuffer
|
|
12151
|
+
}, {
|
|
12152
|
+
retries: 3,
|
|
12153
|
+
retryDelay: 20,
|
|
12154
|
+
timeout: 3000
|
|
12155
|
+
});
|
|
12156
|
+
if (2000 === uploadImgResp.code) return isCover ? uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri : {
|
|
12157
|
+
uri: uploadAddr.Result.UploadAddress.StoreInfos[0].StoreUri,
|
|
12158
|
+
width: 1258,
|
|
12159
|
+
height: 1048
|
|
12160
|
+
};
|
|
12161
|
+
}
|
|
12162
|
+
if (params.coverImage) {
|
|
12163
|
+
const images = await Promise.all([
|
|
12164
|
+
params.coverImage
|
|
12165
|
+
].map((url)=>{
|
|
12166
|
+
if (!url) throw new Error("封面图片 URL 不能为空");
|
|
12167
|
+
const fileName = (0, share_namespaceObject.getFilenameFromUrl)(url);
|
|
12168
|
+
return (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
12169
|
+
}));
|
|
12170
|
+
const coverUploadAddr = await GetUploadAddr(images[0], true);
|
|
12171
|
+
publishData.item.cover = {
|
|
12172
|
+
poster: coverUploadAddr
|
|
12173
|
+
};
|
|
12174
|
+
}
|
|
12175
|
+
if (params.banners) {
|
|
12176
|
+
const images = await Promise.all(params.banners.map((url)=>{
|
|
12177
|
+
if (!url) throw new Error("内容图片 URL 不能为空");
|
|
12178
|
+
const fileName = (0, share_namespaceObject.getFilenameFromUrl)(url);
|
|
12179
|
+
return (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
12180
|
+
}));
|
|
12181
|
+
const contentUploadAddr = await Promise.all(images.map((url)=>GetUploadAddr(url, false)));
|
|
12182
|
+
publishData.item.common.images = contentUploadAddr;
|
|
12183
|
+
}
|
|
12184
|
+
proxyHttp.addResponseInterceptor((response)=>{
|
|
12185
|
+
if (!response || !response.data) return;
|
|
12186
|
+
const responseData = response.data;
|
|
12187
|
+
if (response && responseData?.status_code && 0 !== responseData.status_code) return {
|
|
12188
|
+
code: responseData?.status_code,
|
|
12189
|
+
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
12190
|
+
data: responseData
|
|
12191
|
+
};
|
|
12192
|
+
});
|
|
12193
|
+
task._timerRecord.PrePublish = Date.now();
|
|
12194
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
12195
|
+
const publishQuery = {
|
|
12196
|
+
...publishParams
|
|
12197
|
+
};
|
|
12198
|
+
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");
|
|
12199
|
+
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
12200
|
+
function generateRandomString(length) {
|
|
12201
|
+
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
12202
|
+
let randomString = "";
|
|
12203
|
+
for(let i = 0; i < length; i++){
|
|
12204
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
12205
|
+
randomString += characters.charAt(randomIndex);
|
|
12206
|
+
}
|
|
12207
|
+
return randomString;
|
|
12208
|
+
}
|
|
12209
|
+
publishData.item.common.creation_id = generateRandomString(8) + Date.now();
|
|
12210
|
+
const csrfToken = generateCsrfTokenAdvanced({
|
|
12211
|
+
cookies: params.cookies,
|
|
12212
|
+
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
12213
|
+
method: "POST",
|
|
12214
|
+
userAgent: headers["user-agent"]
|
|
12215
|
+
});
|
|
12216
|
+
console.log("发布数据", JSON.stringify(publishData));
|
|
12217
|
+
const publishResult = await proxyHttp.api({
|
|
12218
|
+
method: "post",
|
|
12219
|
+
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
12220
|
+
data: publishData,
|
|
12221
|
+
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
12222
|
+
headers: {
|
|
12223
|
+
...headers,
|
|
12224
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
12225
|
+
"Content-Type": "application/json",
|
|
12226
|
+
"Bd-ticket-guard-client-data": bdTicketGuardClientData,
|
|
12227
|
+
"Bd-ticket-guard-ree-public-key": ree_public_key,
|
|
12228
|
+
"Bd-ticket-guard-version": 2,
|
|
12229
|
+
"Bd-ticket-guard-web-sign-type": 1,
|
|
12230
|
+
"Bd-ticket-guard-web-version": 2,
|
|
12231
|
+
"X-secsdk-csrf-token": csrfToken,
|
|
12232
|
+
"X-tt-session-dtrait": params.cookies.find((e)=>"x-tt-session-dtrait" === e.name)?.value || ""
|
|
12233
|
+
}
|
|
12234
|
+
}, {
|
|
12235
|
+
retries: 2,
|
|
12236
|
+
retryDelay: 500,
|
|
12237
|
+
timeout: 12000
|
|
12238
|
+
});
|
|
12239
|
+
console.log("publishResult", publishResult);
|
|
12240
|
+
const isSuccess = 0 === publishResult.status_code;
|
|
12241
|
+
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
12242
|
+
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
12243
|
+
if (!isSuccess) {
|
|
12244
|
+
await updateTaskState?.({
|
|
12245
|
+
state: share_namespaceObject.TaskState.FAILED,
|
|
12246
|
+
error: message
|
|
12247
|
+
});
|
|
12248
|
+
return {
|
|
12249
|
+
code: 414,
|
|
12250
|
+
data,
|
|
12251
|
+
message
|
|
12252
|
+
};
|
|
12253
|
+
}
|
|
12254
|
+
await updateTaskState?.({
|
|
12255
|
+
state: share_namespaceObject.TaskState.SUCCESS,
|
|
12256
|
+
result: {
|
|
12257
|
+
response: data
|
|
12258
|
+
}
|
|
12259
|
+
});
|
|
12260
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
12261
|
+
};
|
|
12262
|
+
const douyinPublish_rpa_rpaAction = async (task, params)=>{
|
|
12263
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
12264
|
+
const commonCookies = {
|
|
12265
|
+
path: "/",
|
|
12266
|
+
secure: true,
|
|
12267
|
+
domain: "douyin.com",
|
|
12268
|
+
url: "https://creator.douyin.com",
|
|
12269
|
+
httpOnly: true
|
|
12270
|
+
};
|
|
12271
|
+
const page = await task.createPage({
|
|
12272
|
+
show: task.debug,
|
|
12273
|
+
url: params.url || "https://creator.douyin.com/creator-micro/content/upload?default-tab=3",
|
|
12274
|
+
cookies: params.cookies?.map((it)=>({
|
|
12275
|
+
...it,
|
|
12276
|
+
...commonCookies
|
|
12277
|
+
}))
|
|
12278
|
+
});
|
|
12279
|
+
await updateTaskState?.({
|
|
12280
|
+
state: share_namespaceObject.TaskState.ACTION,
|
|
12281
|
+
connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
|
|
12282
|
+
sessionId: task.sessionId
|
|
12283
|
+
});
|
|
12284
|
+
const tmpCachePath = task.getTmpPath();
|
|
12285
|
+
try {
|
|
12286
|
+
await page.waitForSelector("#micro", {
|
|
12287
|
+
state: "visible",
|
|
12288
|
+
timeout: 20000
|
|
12289
|
+
});
|
|
12290
|
+
} catch (error) {
|
|
12291
|
+
return {
|
|
12292
|
+
code: 414,
|
|
12293
|
+
message: "登录失效",
|
|
12294
|
+
data: page.url()
|
|
12295
|
+
};
|
|
12296
|
+
}
|
|
12297
|
+
const images = await Promise.all([
|
|
12298
|
+
"https://svip-8.rcouyi.com/file/draw/volc/2026/01/15/2011725723554811904.png"
|
|
12299
|
+
].map((url)=>{
|
|
12300
|
+
const fileName = (0, share_namespaceObject.getFilenameFromUrl)(url);
|
|
12301
|
+
return (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
12302
|
+
}));
|
|
12303
|
+
const fileChooser = await page.waitForSelector('input[type="file"]', {
|
|
12304
|
+
timeout: 20000
|
|
12305
|
+
});
|
|
12306
|
+
if (fileChooser) await fileChooser.setInputFiles(images);
|
|
12307
|
+
const titleInstance = page.locator(".semi-input-wrapper input[placeholder='添加作品标题']");
|
|
12308
|
+
await titleInstance.waitFor({
|
|
12309
|
+
state: "visible",
|
|
12310
|
+
timeout: 50000
|
|
12311
|
+
});
|
|
12312
|
+
await titleInstance.click();
|
|
12313
|
+
await titleInstance.fill(params.title || "1111");
|
|
12314
|
+
await page.waitForTimeout(1000);
|
|
12315
|
+
const descInstance = page.locator("div[data-placeholder='添加作品描述...']");
|
|
12316
|
+
await descInstance.click();
|
|
12317
|
+
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, "") || "22222");
|
|
12318
|
+
if ("2" === params.visibleRange) await page.locator("label:has-text('好友可见')").first().click();
|
|
12319
|
+
else if ("3" === params.visibleRange) await page.locator("label:has-text('仅自己可见')").first().click();
|
|
12320
|
+
if (!params.isImmediatelyPublish) {
|
|
12321
|
+
await await page.locator('label:has-text("定时发布")').first().click();
|
|
12322
|
+
await page.waitForTimeout(500);
|
|
12323
|
+
const releaseTimeInstance = page.locator(".semi-datepicker-input input[placeholder='日期和时间']");
|
|
12324
|
+
await releaseTimeInstance.click();
|
|
12325
|
+
await page.waitForTimeout(1000);
|
|
12326
|
+
await releaseTimeInstance.fill(params.scheduledPublish || "2026-02-01 15:30:30");
|
|
12327
|
+
await releaseTimeInstance.blur();
|
|
12328
|
+
}
|
|
12329
|
+
const response = await new Promise((resolve)=>{
|
|
12330
|
+
const handleResponse = async (response)=>{
|
|
12331
|
+
if (response.url().includes("/web/api/media/aweme/create_v2")) {
|
|
12332
|
+
console.log("匹配到发布接口响应");
|
|
12333
|
+
const jsonResponse = await response.json();
|
|
12334
|
+
console.log("发布接口响应数据:", jsonResponse);
|
|
12335
|
+
page.off("response", handleResponse);
|
|
12336
|
+
resolve(jsonResponse?.data?.item_id);
|
|
12337
|
+
}
|
|
12338
|
+
};
|
|
12339
|
+
console.log("监听响应事件");
|
|
12340
|
+
page.on("response", handleResponse);
|
|
12341
|
+
console.log("点击发布按钮");
|
|
12342
|
+
page.locator("#DCPF button:has-text('发布')").first().click();
|
|
12343
|
+
console.log("发布按钮已点击");
|
|
12344
|
+
});
|
|
12345
|
+
await updateTaskState?.({
|
|
12346
|
+
state: share_namespaceObject.TaskState.SUCCESS,
|
|
12347
|
+
result: {
|
|
12348
|
+
response
|
|
12349
|
+
}
|
|
12350
|
+
});
|
|
12351
|
+
await page.close();
|
|
12352
|
+
return (0, share_namespaceObject.success)(response);
|
|
12353
|
+
};
|
|
12354
|
+
const FictionalRendition = schemas_object({
|
|
12355
|
+
type: literal("fictional-rendition")
|
|
12356
|
+
});
|
|
12357
|
+
const AIGenerated = schemas_object({
|
|
12358
|
+
type: literal("ai-generated")
|
|
12359
|
+
});
|
|
12360
|
+
const SourceStatement = schemas_object({
|
|
12361
|
+
type: literal("source-statement"),
|
|
12362
|
+
childType: schemas_enum([
|
|
12363
|
+
"self-labeling",
|
|
12364
|
+
"self-shooting",
|
|
12365
|
+
"transshipment"
|
|
12366
|
+
]),
|
|
12367
|
+
shootingLocation: schemas_object({
|
|
12368
|
+
id: schemas_string(),
|
|
12369
|
+
name: schemas_string(),
|
|
12370
|
+
latitude: schemas_number().optional(),
|
|
12371
|
+
longitude: schemas_number().optional()
|
|
12372
|
+
}).optional(),
|
|
12373
|
+
shootingDate: schemas_string().optional(),
|
|
12374
|
+
sourceMedia: schemas_string().optional()
|
|
12375
|
+
});
|
|
12376
|
+
union([
|
|
12377
|
+
FictionalRendition,
|
|
12378
|
+
AIGenerated,
|
|
12379
|
+
SourceStatement
|
|
12380
|
+
]);
|
|
12381
|
+
const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
12382
|
+
banners: schemas_array(schemas_string()),
|
|
12383
|
+
title: schemas_string(),
|
|
12384
|
+
content: schemas_string(),
|
|
12385
|
+
coverImage: schemas_string().optional(),
|
|
12386
|
+
videoFile: schemas_string().optional(),
|
|
12387
|
+
address: schemas_object({
|
|
12388
|
+
id: schemas_string(),
|
|
12389
|
+
name: schemas_string(),
|
|
12390
|
+
latitude: schemas_number().optional(),
|
|
12391
|
+
longitude: schemas_number().optional()
|
|
12392
|
+
}).optional(),
|
|
12393
|
+
selfDeclaration: custom().optional(),
|
|
12394
|
+
topic: schemas_array(schemas_object({
|
|
12395
|
+
id: schemas_string(),
|
|
12396
|
+
word: schemas_string()
|
|
12397
|
+
})).optional(),
|
|
12398
|
+
proxyLoc: schemas_string().optional(),
|
|
12399
|
+
localIP: schemas_string().optional(),
|
|
12400
|
+
visibleRange: schemas_enum([
|
|
12401
|
+
"1",
|
|
12402
|
+
"2",
|
|
12403
|
+
"3"
|
|
12404
|
+
]).optional(),
|
|
12405
|
+
isImmediatelyPublish: schemas_boolean().optional(),
|
|
12406
|
+
scheduledPublish: schemas_string().optional(),
|
|
12407
|
+
isOriginal: schemas_boolean().optional(),
|
|
12408
|
+
allowCoProduce: schemas_boolean().optional(),
|
|
12409
|
+
allowCopy: schemas_boolean().optional(),
|
|
12410
|
+
publishType: schemas_enum([
|
|
12411
|
+
"1",
|
|
12412
|
+
"2",
|
|
12413
|
+
"3",
|
|
12414
|
+
"4"
|
|
12415
|
+
]).optional(),
|
|
12416
|
+
publishAction: schemas_enum([
|
|
12417
|
+
"publish",
|
|
12418
|
+
"draft"
|
|
12419
|
+
]).optional(),
|
|
12420
|
+
isAiCoverImage: schemas_boolean().optional(),
|
|
12421
|
+
summary: schemas_string().optional()
|
|
12422
|
+
});
|
|
12423
|
+
const douyinPublish = async (task, params)=>{
|
|
12424
|
+
if ("rpa" === params.actionType) return douyinPublish_rpa_rpaAction(task, params);
|
|
12425
|
+
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
12426
|
+
return executeAction(mock_mockAction, douyinPublish_rpa_rpaAction)(task, params);
|
|
12427
|
+
};
|
|
10763
12428
|
const getBaijiahaoActivity = async (_task, params)=>{
|
|
10764
12429
|
const cookies = params.cookies ?? [];
|
|
10765
12430
|
const http = new Http({
|
|
@@ -12913,7 +14578,7 @@ var __webpack_exports__ = {};
|
|
|
12913
14578
|
else if (message?.includes("资料审核")) error = errorList[2];
|
|
12914
14579
|
return error || ("draft" === saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。");
|
|
12915
14580
|
};
|
|
12916
|
-
const
|
|
14581
|
+
const toutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
12917
14582
|
const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
|
|
12918
14583
|
const tmpCachePath = task.getTmpPath();
|
|
12919
14584
|
const headers = {
|
|
@@ -13421,8 +15086,8 @@ var __webpack_exports__ = {};
|
|
|
13421
15086
|
const toutiaoPublish = async (task, params)=>{
|
|
13422
15087
|
params.content = formatSectionHtml(params.content);
|
|
13423
15088
|
if ("rpa" === params.actionType) return toutiaoPublish_rpa_rpaAction(task, params);
|
|
13424
|
-
if ("mockApi" === params.actionType) return
|
|
13425
|
-
return executeAction(
|
|
15089
|
+
if ("mockApi" === params.actionType) return toutiaoPublish_mock_mockAction(task, params);
|
|
15090
|
+
return executeAction(toutiaoPublish_mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
|
|
13426
15091
|
};
|
|
13427
15092
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
13428
15093
|
const tmpCachePath = task.getTmpPath();
|
|
@@ -17218,13 +18883,13 @@ var __webpack_exports__ = {};
|
|
|
17218
18883
|
});
|
|
17219
18884
|
return (0, share_namespaceObject.success)(data, message);
|
|
17220
18885
|
};
|
|
17221
|
-
const
|
|
18886
|
+
const xiaohongshuPublish_FictionalRendition = schemas_object({
|
|
17222
18887
|
type: literal("fictional-rendition")
|
|
17223
18888
|
});
|
|
17224
|
-
const
|
|
18889
|
+
const xiaohongshuPublish_AIGenerated = schemas_object({
|
|
17225
18890
|
type: literal("ai-generated")
|
|
17226
18891
|
});
|
|
17227
|
-
const
|
|
18892
|
+
const xiaohongshuPublish_SourceStatement = schemas_object({
|
|
17228
18893
|
type: literal("source-statement"),
|
|
17229
18894
|
childType: schemas_enum([
|
|
17230
18895
|
"self-labeling",
|
|
@@ -17236,9 +18901,9 @@ var __webpack_exports__ = {};
|
|
|
17236
18901
|
sourceMedia: schemas_string().optional()
|
|
17237
18902
|
});
|
|
17238
18903
|
union([
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
18904
|
+
xiaohongshuPublish_FictionalRendition,
|
|
18905
|
+
xiaohongshuPublish_AIGenerated,
|
|
18906
|
+
xiaohongshuPublish_SourceStatement
|
|
17242
18907
|
]);
|
|
17243
18908
|
const XiaohongshuPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
17244
18909
|
banners: schemas_array(schemas_string()),
|
|
@@ -17925,6 +19590,9 @@ var __webpack_exports__ = {};
|
|
|
17925
19590
|
BjhSessionCheck(params) {
|
|
17926
19591
|
return this.bindTask(BjhSessionCheck, params);
|
|
17927
19592
|
}
|
|
19593
|
+
DySessionCheck(params) {
|
|
19594
|
+
return this.bindTask(DySessionCheck, params);
|
|
19595
|
+
}
|
|
17928
19596
|
searchToutiaoTopicList(params) {
|
|
17929
19597
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
17930
19598
|
}
|
|
@@ -18000,6 +19668,33 @@ var __webpack_exports__ = {};
|
|
|
18000
19668
|
weixinPublish(params) {
|
|
18001
19669
|
return this.bindTask(weixinPublish, params);
|
|
18002
19670
|
}
|
|
19671
|
+
douyinPublish(params) {
|
|
19672
|
+
return this.bindTask(douyinPublish, params);
|
|
19673
|
+
}
|
|
19674
|
+
douyinGetTopics(params) {
|
|
19675
|
+
return this.bindTask(douyinGetTopics, params);
|
|
19676
|
+
}
|
|
19677
|
+
douyinGetMusicCategory(params) {
|
|
19678
|
+
return this.bindTask(douyinGetMusicCategory, params);
|
|
19679
|
+
}
|
|
19680
|
+
douyinGetMusicByCategory(params) {
|
|
19681
|
+
return this.bindTask(douyinGetMusicByCategory, params);
|
|
19682
|
+
}
|
|
19683
|
+
douyinGetMusic(params) {
|
|
19684
|
+
return this.bindTask(douyinGetMusic, params);
|
|
19685
|
+
}
|
|
19686
|
+
douyinGetLocation(params) {
|
|
19687
|
+
return this.bindTask(douyinGetLocation, params);
|
|
19688
|
+
}
|
|
19689
|
+
douyinGetHot(params) {
|
|
19690
|
+
return this.bindTask(douyinGetHot, params);
|
|
19691
|
+
}
|
|
19692
|
+
douyinGetCollection(params) {
|
|
19693
|
+
return this.bindTask(douyinGetCollection, params);
|
|
19694
|
+
}
|
|
19695
|
+
douyinLogin(params) {
|
|
19696
|
+
return this.bindTask(douyinLogin, params);
|
|
19697
|
+
}
|
|
18003
19698
|
}
|
|
18004
19699
|
})();
|
|
18005
19700
|
var __webpack_export_target__ = exports;
|