node-youtube-music
Advanced tools
Comparing version 0.2.4 to 0.2.5
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const src_1 = require("../src"); | ||
const main = () => src_1.default.search('DJOKO', { lang: 'en-US' }); | ||
const main = () => src_1.default.search('sitting waiting wishing', { lang: 'fr-FR', country: 'FR' }); | ||
main().then((results) => console.log(results)); |
declare const _default: { | ||
body: (lang?: string | undefined) => { | ||
body: (lang?: string | undefined, country?: string | undefined) => { | ||
context: { | ||
@@ -11,2 +11,3 @@ capabilities: {}; | ||
hl: string; | ||
gl: string; | ||
locationInfo: { | ||
@@ -13,0 +14,0 @@ locationPermissionAuthorizationStatus: string; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
body: (lang) => ({ | ||
body: (lang, country) => ({ | ||
context: { | ||
@@ -15,2 +15,3 @@ capabilities: {}, | ||
hl: lang !== null && lang !== void 0 ? lang : 'en', | ||
gl: country !== null && country !== void 0 ? country : 'GB', | ||
locationInfo: { | ||
@@ -17,0 +18,0 @@ locationPermissionAuthorizationStatus: 'LOCATION_PERMISSION_AUTHORIZATION_STATUS_UNSUPPORTED', |
@@ -19,3 +19,3 @@ "use strict"; | ||
const response = yield got_1.default.post('https://music.youtube.com/youtubei/v1/search', { | ||
json: Object.assign(Object.assign({}, context_1.default.body(options === null || options === void 0 ? void 0 : options.lang)), { params: 'EgWKAQIIAWoKEAoQCRADEAQQBQ%3D%3D', query }), | ||
json: Object.assign(Object.assign({}, context_1.default.body(options === null || options === void 0 ? void 0 : options.lang, options === null || options === void 0 ? void 0 : options.country)), { params: 'EgWKAQIIAWoKEAoQCRADEAQQBQ%3D%3D', query }), | ||
searchParams: { | ||
@@ -22,0 +22,0 @@ alt: 'json', |
import ytMusic from '../src'; | ||
const main = () => ytMusic.search('DJOKO', { lang: 'fr-FR' }); | ||
const main = () => | ||
ytMusic.search('sitting waiting wishing', { lang: 'fr-FR', country: 'FR' }); | ||
main().then((results) => console.log(results)); |
{ | ||
"name": "node-youtube-music", | ||
"description": "Unofficial YouTube Music API for Node.js", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"main": "dist/src/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/src/index.d.ts", |
export default { | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
body: (lang?: string) => ({ | ||
body: (lang?: string, country?: string) => ({ | ||
context: { | ||
@@ -12,2 +12,3 @@ capabilities: {}, | ||
hl: lang ?? 'en', | ||
gl: country ?? 'GB', | ||
locationInfo: { | ||
@@ -14,0 +15,0 @@ locationPermissionAuthorizationStatus: |
@@ -17,3 +17,3 @@ import got from 'got'; | ||
json: { | ||
...context.body(options?.lang), | ||
...context.body(options?.lang, options?.country), | ||
params: 'EgWKAQIIAWoKEAoQCRADEAQQBQ%3D%3D', | ||
@@ -20,0 +20,0 @@ query, |
34600
850