ytmusic_api_unofficial
Version:
A simple API to get music from YouTube Music
61 lines • 2.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.countriesCodes = exports.countries = exports.options = exports.TYPE_SEARCH_CODE = exports.all_TYPES = exports.UN_TYPES = exports.AvailableFormat = exports.AvailableQuality = void 0;
const countries_1 = require("./countries");
const date = new Date();
exports.AvailableQuality = ['low', 'medium', 'high'];
exports.AvailableFormat = ['mp3', 'webm'];
exports.UN_TYPES = ["song", "video", "playlist", "artist", "podcast", "profile", "station", "episode"];
exports.all_TYPES = ['false', "album", ...exports.UN_TYPES];
exports.TYPE_SEARCH_CODE = {
song: 'EgWKAQIIAWoOEAMQBBAJEA4QChAFEBU%3D',
video: 'EgWKAQIQAWoOEAkQBRADEAQQDhAKEBU%3D',
album: 'EgWKAQIYAWoQEAMQBBAJEAoQBRAREBAQFQ%3D%3D',
artist_song: 'EgWKAQIIAWoSEAMQBBAJEA4QChAFEBEQEBAV',
artist_video: 'EgWKAQIQAWoSEAMQBBAJEA4QChAFEBEQEBAV',
artist_album: 'EgWKAQIYAWoSEAMQBBAJEA4QChAFEBEQEBAV',
};
exports.options = {
country: 'en',
fetch: false
};
exports.default = {
apiUrl: 'https://music.youtube.com/youtubei/v1/',
header: {
'Content-Type': 'application/json',
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
"cookie": "SOCS=CAI",
'Referer': 'https://music.youtube.com/',
'Origin': 'https://music.youtube.com',
'Accept-Language': 'en-US,en;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*',
'Connection': 'keep-alive',
'X-Goog-Visitor-Id': '',
'X-Goog-AuthUser': '0',
'X-Goog-PageId': 'none',
'X-Goog-Encode-Response-If-Executable': 'base64',
'X-Goog-ME': 'true',
"x-youtube-bootstrap-logged-in": false,
"x-youtube-client-name": 67,
"x-youtube-client-version": "1.20250310.01.00",
"sec-ch-ua-full-version": "134.0.6998.44"
},
body: {
"context": {
"client": {
"clientName": "WEB_REMIX",
"clientVersion": "1." + date.getUTCFullYear() + (date.getUTCMonth() + 1).toString().padStart(2, '0') + date.getUTCDate().toString().padStart(2, '0') + ".01.00",
"originalUrl": "https://music.youtube.com",
"hl": "en", // language app
"gl": "US", // language result
},
"user": {
lockedSafetyMode: false
},
}
},
};
exports.countries = countries_1.COUNTRIES.map((country) => country.name) || [];
exports.countriesCodes = countries_1.COUNTRIES.map((country) => country.codeCountry) || [];
//# sourceMappingURL=default.js.map