#
Importing The Library
- This page shows you how to import the library, which allows you to interact with the YouTube Music API seamlessly. Here's how you can import the library in both TypeScript (ESNext) and JavaScript (ES2016).
#
Installation
First, make sure you have the library installed in your project. You can install it via npm or yarn:
npm install youtubemusic.js
# or
yarn add youtubemusic.js
#
Importing in JavaScript (ES2016)
#
Importing the Namespace
// Importing the namespace - ES 2016
const YoutubeMusic = require("youtubemusic.js").default;
#
Importing the Class
// Importing the class - ES 2016
const { YoutubeMusic } = require("youtubemusic.js");
#
Importing Direct Functions
// Importing direct functions - ES 2016
const { getAlbum, getArtist, getTrack, getPlaylist } =
require("youtubemusic.js").default;
#
Importing in TypeScript (ESNext)
#
Importing the Namespace
// Importing the namespace - TypeScript ESNext
import YoutubeMusic from "youtubemusic.js";
#
Importing the Class
// Importing the class - TypeScript ESNext
import { YoutubeMusic } from "youtubemusic.js";
#
Importing Direct Enums and Functions
// Importing direct Enums and functions - TypeScript ESNext
import {
getAlbum,
getPlaylist,
getTrack,
Get,
SearchType,
} from "youtubemusic.js";
Remember to consult the library documentation for specific methods and their usage instructions. Feel free to reach out if you have any questions or issues.
Happy coding! 🎉