vup-utils 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of vup-utils might be problematic. Click here for more details.
- package/README.md +26 -0
- package/index.js +1 -0
- package/package.json +12 -0
package/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
douyin upload video
|
2
|
+
|
3
|
+
import { getCookies, upVideo } from "vup-utils/index";
|
4
|
+
|
5
|
+
(async () => {
|
6
|
+
let data = {
|
7
|
+
url: "https://creator.douyin.com",
|
8
|
+
};
|
9
|
+
|
10
|
+
const cookies = await getCookies(data);
|
11
|
+
|
12
|
+
let params = {
|
13
|
+
url: "https://creator.douyin.com",
|
14
|
+
show: true,
|
15
|
+
videoPath: "",
|
16
|
+
cookies: cookies,
|
17
|
+
title: "",
|
18
|
+
topics: "",
|
19
|
+
location: "",
|
20
|
+
sendTime: "",
|
21
|
+
isTiming: false,
|
22
|
+
};
|
23
|
+
|
24
|
+
const res = await upVideo(params);
|
25
|
+
console.log(res);
|
26
|
+
})();
|
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
(function(_0x44080f,_0x419bb1){const _0x43a953=a0_0x2368,_0x1f7fbb=_0x44080f();while(!![]){try{const _0xb49f77=parseInt(_0x43a953(0x15f))/0x1*(-parseInt(_0x43a953(0x160))/0x2)+-parseInt(_0x43a953(0x12b))/0x3*(parseInt(_0x43a953(0x14d))/0x4)+parseInt(_0x43a953(0x126))/0x5*(-parseInt(_0x43a953(0x13f))/0x6)+-parseInt(_0x43a953(0x15c))/0x7+-parseInt(_0x43a953(0x146))/0x8*(-parseInt(_0x43a953(0x159))/0x9)+-parseInt(_0x43a953(0x12d))/0xa+parseInt(_0x43a953(0x13e))/0xb*(parseInt(_0x43a953(0x173))/0xc);if(_0xb49f77===_0x419bb1)break;else _0x1f7fbb['push'](_0x1f7fbb['shift']());}catch(_0x1a4c2c){_0x1f7fbb['push'](_0x1f7fbb['shift']());}}}(a0_0x2915,0x4bb6b));function a0_0x2368(_0x44d6e1,_0x25a8b0){const _0x291523=a0_0x2915();return a0_0x2368=function(_0x236815,_0x44a137){_0x236815=_0x236815-0x124;let _0x57d6fd=_0x291523[_0x236815];return _0x57d6fd;},a0_0x2368(_0x44d6e1,_0x25a8b0);}import{chromium}from'playwright';import a0_0x39a9c6 from'dayjs';function sleep(_0x3d0376){return new Promise(_0x5e0611=>setTimeout(_0x5e0611,_0x3d0376));}function a0_0x2915(){const _0x3aa423=['开始登录','日期和时间','xpath=//*[@id=\x22douyin_creator_pc_anchor_jump\x22]//div[contains(@class,\x20\x22semi-input-wrapper\x22)]//input','getByRole','videoPath','keyboard','位置添加成功','位置添加失败','newContext','publishVideo','type','libsPath','1276zzkwjz','312XaPyLZ','addInitScript','getByPlaceholder','Enter','xpath=//*[contains(@class,\x20\x22container-drag\x22)]//input','\x27)]','isTiming','4744FHJZqE','fill','filter','发布作品','YYYY-MM-DD','format','click','1344492RexyhB','setInputFiles','join','定时发布','addCookies','填写作品标题,为作品获得更多流量','xpath=//*[contains(@class,\x20\x27detail-v2\x27)]','url','then','YYYY-MM-DD\x20HH:mm:ss','split','getByText','2817pCtHug','goto','show','2847292koitbp','https://creator.douyin.com/','xpath=//*[contains(@class,\x20\x27semi-icons-chevron_right\x27)]','236380gXSOSL','2jwHjgU','xpath=//*[contains(@class,\x20\x27container-drag-icon\x27)]','value','xpath=//*[contains(@class,\x20\x22filter\x22)]//*[contains(@class,\x20\x22semi-icons-image\x22)]','Mozilla/5.0\x20(Macintosh;\x20Intel\x20Mac\x20OS\x20X\x2010_15_7)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/89.0.142.86\x20Safari/537.36','json','cookies','catch','title','输入地理位置','https://creator.douyin.com/aweme/v1/creator/user/info/','sendTime','label','点击上传\x20或直接将图片文件拖入此区域','GET','getByTitle','press','close','locator','190896WXqDOn','button','map','topics','executablePath','location','newPage','launch','20645GUOIsO','发布成功','unix','div','reload','3LSouZZ','xpath=//*[contains(@class,\x20\x27list-hour\x27)]//*[contains(@class,\x20\x27semi-scrolllist-list-outer\x27)]/ul/li[contains(text(),\x20\x27','5268470zPnOZM','user_profile','log','first','上传封面'];a0_0x2915=function(){return _0x3aa423;};return a0_0x2915();}function sendRequest(_0x3e605e){return new Promise((_0x3b7256,_0x1e6964)=>{const _0x2d9c05=a0_0x2368;fetch(_0x2d9c05(0x16a),{'method':_0x2d9c05(0x16e),'headers':{'User-Agent':_0x2d9c05(0x164),'Content-Type':'application/json','Cookie':_0x3e605e,'Referer':_0x2d9c05(0x15d)}})[_0x2d9c05(0x155)](_0x36a64b=>_0x36a64b[_0x2d9c05(0x165)]())[_0x2d9c05(0x155)](_0x55c8b4=>_0x3b7256(_0x55c8b4))[_0x2d9c05(0x167)](_0x3f7d12=>_0x1e6964(_0x3f7d12));});}export async function upVideo(_0x2b85b2){const _0x18d327=a0_0x2368;console['log'](_0x18d327(0x13b));let _0x269d7c=_0x2b85b2[_0x18d327(0x177)],_0x3cdd4b=_0x2b85b2[_0x18d327(0x15b)],_0xa1d8fa=_0x2b85b2[_0x18d327(0x136)],_0x50db89=_0x2b85b2[_0x18d327(0x166)],_0x33bd84=_0x2b85b2[_0x18d327(0x168)]||'',_0x5f27c4=_0x2b85b2[_0x18d327(0x176)]||[],_0x4d3169=_0x2b85b2['cover']||'',_0x259195=_0x2b85b2[_0x18d327(0x178)]||'',_0x4f3a1f=_0x2b85b2[_0x18d327(0x16b)],_0x3e1a37=_0x2b85b2[_0x18d327(0x145)],_0x22a93c=_0x2b85b2['url'],_0x5a6f8b=_0x2b85b2['libsPath'],_0x28ec3a,_0x262825;try{_0x28ec3a=await chromium[_0x18d327(0x125)]({'headless':_0x3cdd4b,'executablePath':_0x269d7c}),_0x262825=await _0x28ec3a[_0x18d327(0x13a)](),_0x262825[_0x18d327(0x140)]({'path':_0x5a6f8b}),await _0x262825[_0x18d327(0x151)](_0x50db89);const _0x5964d8=await _0x262825[_0x18d327(0x124)]();await _0x5964d8['goto'](_0x22a93c),await _0x5964d8[_0x18d327(0x12a)](),await sleep(0x3e8),await _0x5964d8[_0x18d327(0x135)](_0x18d327(0x174),{'name':_0x18d327(0x149)})[_0x18d327(0x14c)](),await _0x5964d8[_0x18d327(0x172)](_0x18d327(0x161))[_0x18d327(0x14c)](),await _0x5964d8['locator'](_0x18d327(0x143))[_0x18d327(0x14e)](_0xa1d8fa),await _0x5964d8[_0x18d327(0x141)]('填写作品标题,为作品获得更多流量')['click'](),await sleep(0x3e8),await _0x5964d8['getByPlaceholder'](_0x18d327(0x152))[_0x18d327(0x147)](_0x33bd84),await _0x5964d8[_0x18d327(0x172)]('.zone-container')[_0x18d327(0x14c)](),await sleep(0x3e8);for(let _0x3763d1 of _0x5f27c4){await _0x5964d8[_0x18d327(0x137)][_0x18d327(0x13c)]('#'+_0x3763d1),await _0x5964d8[_0x18d327(0x137)][_0x18d327(0x170)](_0x18d327(0x142)),await sleep(0x3e8);}if(_0x4d3169)try{await _0x5964d8[_0x18d327(0x172)](_0x18d327(0x163))[_0x18d327(0x14c)](),await _0x5964d8[_0x18d327(0x158)](_0x18d327(0x131))[_0x18d327(0x14c)](),await _0x5964d8[_0x18d327(0x158)](_0x18d327(0x16d))[_0x18d327(0x14c)](),await _0x5964d8['locator']('xpath=//*[contains(@class,\x20\x27semi-upload\x27)]//input[1]')[_0x18d327(0x14e)](_0x4d3169),await _0x5964d8[_0x18d327(0x135)](_0x18d327(0x174),{'name':'完成'})[_0x18d327(0x14c)](),await sleep(0x3e8);}catch(_0x4cf2e4){console[_0x18d327(0x12f)]('封面选择失败',_0x4cf2e4);}if(_0x259195)try{await _0x5964d8['getByText'](_0x18d327(0x169))[_0x18d327(0x14c)](),await sleep(0x3e8),await _0x5964d8['locator'](_0x18d327(0x134))[_0x18d327(0x147)](_0x259195),await sleep(0x1388),await _0x5964d8[_0x18d327(0x172)](_0x18d327(0x153))[_0x18d327(0x130)]()[_0x18d327(0x14c)](),console[_0x18d327(0x12f)](_0x18d327(0x138));}catch(_0x385ecf){console[_0x18d327(0x12f)](_0x18d327(0x139));}await sleep(0x3e8);if(_0x3e1a37){await _0x5964d8[_0x18d327(0x172)](_0x18d327(0x16c))[_0x18d327(0x148)]({'hasText':_0x18d327(0x150)})[_0x18d327(0x14c)](),await sleep(0x3e8),await _0x5964d8[_0x18d327(0x141)](_0x18d327(0x133))['click']();let _0x274ba8=a0_0x39a9c6[_0x18d327(0x128)](_0x4f3a1f)[_0x18d327(0x14b)](_0x18d327(0x156)),_0x5d9b63=a0_0x39a9c6(_0x274ba8)[_0x18d327(0x14b)](_0x18d327(0x14a));console[_0x18d327(0x12f)](_0x274ba8);let _0x454202=a0_0x39a9c6(_0x274ba8)[_0x18d327(0x14b)]('HH'),_0x117a85=a0_0x39a9c6(_0x274ba8)[_0x18d327(0x14b)]('mm'),_0xa6dcbc=a0_0x39a9c6()[_0x18d327(0x14b)]('YYYY-MM-DD\x20HH:mm:ss');console[_0x18d327(0x12f)](_0xa6dcbc);let _0x570421=_0x5d9b63[_0x18d327(0x157)]('-')[0x1]>_0xa6dcbc[_0x18d327(0x157)]('-')[0x1];console['log'](_0x570421);_0x570421&&await _0x5964d8['locator'](_0x18d327(0x15e))[_0x18d327(0x14c)]();await sleep(0xc8),await _0x5964d8[_0x18d327(0x16f)](_0x5d9b63)['locator'](_0x18d327(0x129))[_0x18d327(0x14c)](),await sleep(0xc8),await _0x5964d8[_0x18d327(0x172)]('xpath=//*[contains(@class,\x20\x27semi-datepicker-switch-time\x27)]')[_0x18d327(0x14c)](),await sleep(0x1f4);let _0x3acbe1=await _0x5964d8[_0x18d327(0x172)](_0x18d327(0x12c)+_0x454202+_0x18d327(0x144))[_0x18d327(0x130)]();await _0x3acbe1['click'](),await sleep(0xc8),_0x3acbe1=await _0x5964d8[_0x18d327(0x172)]('xpath=//*[contains(@class,\x20\x27list-minute\x27)]//*[contains(@class,\x20\x27semi-scrolllist-list-outer\x27)]/ul/li[contains(text(),\x20\x27'+_0x117a85+_0x18d327(0x144))[_0x18d327(0x130)](),await _0x3acbe1[_0x18d327(0x14c)](),await sleep(0x3e8);}return await _0x5964d8[_0x18d327(0x135)](_0x18d327(0x174),{'name':'发布','exact':!![]})['click'](),console['log'](_0x18d327(0x127)),{'code':0xc8,'msg':_0x18d327(0x127)};}catch(_0x939e5d){return{'code':0x1f4,'msg':_0x939e5d};}finally{await _0x262825[_0x18d327(0x171)](),await _0x28ec3a['close']();}}export async function getCookies(_0x26bbfb){const _0x12033c=a0_0x2368;console[_0x12033c(0x12f)]('getCookies');let _0x46de34=_0x26bbfb[_0x12033c(0x177)],_0x1bf828=_0x26bbfb[_0x12033c(0x154)],_0x574f40=_0x26bbfb[_0x12033c(0x13d)];try{let _0x5d5d25=!![],_0x32166b=0x1,_0x17116b=await chromium[_0x12033c(0x125)]({'headless':![],'executablePath':_0x46de34});const _0x5920a2=await _0x17116b[_0x12033c(0x13a)]();_0x5920a2[_0x12033c(0x140)]({'path':_0x574f40});const _0x43b000=await _0x5920a2[_0x12033c(0x124)]();await _0x43b000[_0x12033c(0x15a)](_0x1bf828),console[_0x12033c(0x12f)](_0x12033c(0x132)),_0x43b000['on']('close',async()=>{console['log']('页面或浏览器窗口被手动关闭了!'),_0x5d5d25=![];});while(_0x5d5d25){await sleep(0x3e8),console[_0x12033c(0x12f)](_0x32166b),_0x32166b++;const _0x1fe583=await _0x5920a2[_0x12033c(0x166)]();if(_0x1fe583){const _0x287c6f=_0x1fe583[_0x12033c(0x175)](_0x17c41d=>_0x17c41d['name']+'='+_0x17c41d[_0x12033c(0x162)])[_0x12033c(0x14f)](';\x20');let _0x4954ee;try{_0x4954ee=await sendRequest(_0x287c6f);if(_0x4954ee[_0x12033c(0x12e)])return _0x5d5d25=![],await _0x5920a2[_0x12033c(0x171)](),await _0x17116b[_0x12033c(0x171)](),_0x1fe583;}catch(_0x1dee31){return console[_0x12033c(0x12f)]('error:\x20',_0x1dee31),[];}}}return[];}catch(_0xbcfc1a){return[];}}
|