fawazahmed0 / youtube-uploader

Free youtube video uploader with no limits
MIT License
364 stars 84 forks source link

How to make it post every 5 minutes ? #108

Closed dori921 closed 2 years ago

dori921 commented 2 years ago

Hello.Im trying to do this by myself but i couldnt,Can anyone help me please ?

enmohsinali commented 2 years ago

Hey @dori921

You achive it very easily by using setInterval(startUploadingVideos,300000) setInterval(fun,delay)

Complete login can be as follows

const videosFolder = "/path_of_your_videos_folder/";
const startUploadingVideos = () => {
    fs.readdir(videosFolder, (err, files) => {
        files.forEach(file => {
            //if your folder also has other files then only upload the video files like mp4
            if(file.includes(".mp4")){
                videos_array.push({ 
                    path: destFolder+file,
                    title: 'Your video title here.',
                    description: 'Your video description here.',
                    onSuccess:onVideoUploadSuccess, skipProcessingWait: true, onProgress: (progress) => { console.log('progress', progress) }
                })
            }
        });
    });
    upload (credentials, videos_array, {headless:false}).then(console.log)
}

setInterval(startUploadingVideos,300000)
dori921 commented 2 years ago

Hello.Thanks for your answer. Im getting this error. image

enmohsinali commented 2 years ago

Opps missed an equal operator.

change this line const startUploadingVideos () => { to this const startUploadingVideos = () => {

dori921 commented 2 years ago

Thanks a lot for your answers,I am getting errors again image

dori921 commented 2 years ago

This is my full code.

const { upload } = require('youtube-videos-uploader');
const credentials = { email: 'myemail@gmail.com', pass: 'mypassword' }

const videosFolder = "C:/Users/dori/Downloads/";
const startUploadingVideos = () => {
    fs.readdir(videosFolder, (err, files) => {
        files.forEach(file => {
            //if your folder also has other files then only upload the video files like mp4
            if(file.includes(".mp4")){
                videos_array.push({ 
                    path: destFolder+file,
                    title: 'Your video title here.',
                    description: 'Your video description here.',
                    onSuccess:onVideoUploadSuccess, skipProcessingWait: true, onProgress: (progress) => { console.log('progress', progress) }
                })
            }
        });
    });
    upload (credentials, videos_array, {headless:false}).then(console.log)
}

setInterval(startUploadingVideos,300000)
enmohsinali commented 2 years ago

change destFolder with videosFolder to correctly set the path. Rest of the code looks good.

dori921 commented 2 years ago

Im having the same error :/

enmohsinali commented 2 years ago

You didn't imported the fs library your full code should be

const { upload } = require('youtube-videos-uploader');
const credentials = { email: 'myemail@gmail.com', pass: 'mypassword' }
const fs = require('fs');

const videosFolder = "C:/Users/dori/Downloads/";
const startUploadingVideos = () => {
    fs.readdir(videosFolder, (err, files) => {
        files.forEach(file => {
            //if your folder also has other files then only upload the video files like mp4
            if(file.includes(".mp4")){
                videos_array.push({ 
                    path: videosFolder+file,
                    title: 'Your video title here.',
                    description: 'Your video description here.',
                    onSuccess:onVideoUploadSuccess, skipProcessingWait: true, onProgress: (progress) => { console.log('progress', progress) }
                })
            }
        });
    });
    upload (credentials, videos_array, {headless:false}).then(console.log)
}

setInterval(startUploadingVideos,300000)
dori921 commented 2 years ago

image Im getting this one now

r8u commented 2 years ago

image Im getting this one now

Go learn javascript then come back to this.

dori921 commented 2 years ago

@r8u i didn't asked you

enmohsinali commented 2 years ago

Hey @dori921 I am sorry to say @r8u said right. You have to learn javascript first because these are basic errors.

Well.. define video_array on top of the function.

dori921 commented 2 years ago

@enmohsinali Thanks a lot for your answers

enmohsinali commented 2 years ago

Your welcome.

fawazahmed0 commented 2 years ago

Paid support is available for quick resolution & help.

For paid support, please write mail to youtube-uploader@datascraping.pp.ua