0.0.4 • Published 3 years ago

lmd-youtube v0.0.4

Weekly downloads
8
License
ISC
Repository
github
Last release
3 years ago

LMD-YOUTUBE

Manage YouTube Data API from NodeJS

Installation

npm i lmd-youtube

Getting started

  1. Create a new file "index.js" :

    //Include lmd-youtube module
    const Youtube = require('lmd-youtube');
    
    async function run()
    {
        //Initialize the instance with your API Key
        const yt = Youtube.getInstance('YourYouTubeAPIKeyHere');
    
        //Get channel data for LMD channel
        const channels = await yt.channels.list({id: 'UCrHKLu5uQE6kFaLFc70T1eg', part: "snippet"});
    
        channels.forEach(async (channel) => 
        {
            console.log(channel.title.toUpperCase());
    
            //Get playlists for the current channel
            const playlists = await channel.playlists.list({ part: "snippet"});
    
            for(const playlist of playlists)
            {
                console.log(` - ${playlist.title}`);
    
                //Get all videos for the current playlist
                const videos = await playlist.videos.list({ part: "snippet"});
    
                for(const video of videos) 
                {
                    console.log(`  - ${video.title}`);
                }
    
                console.log('');
            }
        });
    }
    
    run();
  2. Run the programme :

    node index.js
0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago