Giter Site home page Giter Site logo

huang's Introduction

const puppeteer =require('puppeteer'); const fs = require('fs'); var arry=[]; fs.readdir('video',function(err,files){ if(err){ console.log(err); } else{ (function getfiles(i){ if(i==files.length){ return console.log(arry); }

        else{
            fs.stat('video/'+files[i],function(error,stats){
                if(error){
                    console.log(error);
                }
                else{
                    if(stats.isFile()){
                        arry.push(files[i]);
                    }
                    getfiles(i+1)
                }
            })     
        }
    })(0)        
}

})

async function main(){ let browser=await puppeteer.launch({headless:false,slowMo:400,defaultViewport:{width:1280,height:800}}); let page=await browser.newPage();

await page.goto('https://sso.douyin.com/?service=https://www.douyin.com/login/type/media#/');

await page.waitFor(5*1000);

for(var i=0;i<arry.length;i++){
//上传视频元操作

    const upLoad = await page.waitForSelector('input[name="upload-btn"]');
    await upLoad.uploadFile('C:\\puppeteer\\03AutoMatuionPost\\video\\'+arry[i]+'');

    const inputText=await page.waitForSelector('div[role="combobox"]');
    await inputText.click();
    await inputText.type('K12Coder,来了老弟');

    const submitBtn=await page.waitForSelector('button[class="button--1SZwR primary--1AMXd fixed--3rEwh"]');
    await submitBtn.click();

    const IknowBtn=await page.waitForSelector('div[class="button--228g0"]');
    if(IknowBtn){
        await IknowBtn.click();
    }

    await page.waitFor(5*1000);
    const upLoadBtn=await page.waitForSelector('a[href="#/upload"]');
    await  upLoadBtn.click();
}

}

main();

huang's People

Contributors

764629040 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.