Skip to content

dimaslanjaka/yt2mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

117 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yt2mp3 NodeJS project

environment

create .env file and fill below config then run node -r dotenv/config your_file.js

TIMES=2
API_KEY=YOUR_API_KEY

config batch

fill url list at batch-youtube.txt (must same directory with process.cwd()) then import or run ts-node -r dotenv/config src/YTDL-batch-file.ts

sample files

  • downloader https://github.com/dimaslanjaka/yt2mp3/blob/master/src/YTDL-downloader.js
  • search query

    yt2mp3/src/YTDL.js

    Lines 209 to 256 in 56d0740

    search(query, pageToken, callback) {
    //pageToken is callback not string
    if (typeof pageToken == 'function') {
    callback = pageToken;
    }
    const API_KEY = this.API_KEY;
    const API_URL = this.API_URL;
    const params = {
    part: 'snippet',
    key: API_KEY,
    q: query,
    type: 'video',
    maxResults: 10,
    order: 'viewCount'
    };
    if (typeof pageToken == 'string') {
    params.pageToken = pageToken;
    }
    //console.log(params);
    this.API_PARAMS = params;
    return axios
    .get(API_URL, { params: params })
    .then(function (response) {
    if (callback) {
    callback(false, response.data.items, response);
    writeFile(
    path.join(ROOT, 'tmp/info/search/', query + (token ? '-' + token : '') + '.json'.trim()),
    response.data
    );
    }
    })
    .catch(function (error) {
    //console.error(error);
    if (error.hasOwnProperty('data')) {
    const msg = error.data.error.message;
    const code = error.data.error.code;
    //console.log(`error (${code}) ${msg} API: ${this.API_KEY}`);
    blockedKeys[API_KEY] = code;
    if (code == 403) {
    console.error('blocking ' + API_KEY);
    localStorage.setItem('blockedKeys', JSON.stringify(blockedKeys));
    }
    callback(new Error('Error Code: ' + code + ', Message: ' + msg + ', API: ' + API_KEY), code, msg);
    }
    });
    }
    }

Test

tested and working FFMPEG with below version:

ffmpeg version git-2019-11-26-59d264b Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191125
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil      56. 36.100 / 56. 36.100
libavcodec     58. 62.100 / 58. 62.100
libavformat    58. 35.100 / 58. 35.100
libavdevice    58.  9.101 / 58.  9.101
libavfilter     7. 67.100 /  7. 67.100
libswscale      5.  6.100 /  5.  6.100
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100

About

Youtube to mp3 deployer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors