✨ add ability to change locale
This commit is contained in:
parent
0c9137a5af
commit
f59cfc7f29
|
|
@ -62,6 +62,6 @@ $ bun test
|
||||||
- [](https://npmjs.com/package/eslint-plugin-simple-import-sort/v/latest)
|
- [](https://npmjs.com/package/eslint-plugin-simple-import-sort/v/latest)
|
||||||
- [](https://npmjs.com/package/prettier/v/latest)
|
- [](https://npmjs.com/package/prettier/v/latest)
|
||||||
- Miscellaneous
|
- Miscellaneous
|
||||||
- [](https://npmjs.com/package/arktype/v/1.0.28-alpha)
|
- [](https://npmjs.com/package/arktype/v/1.0.29-alpha)
|
||||||
- [](https://npmjs.com/package/axios/v/0.27.2)
|
- [](https://npmjs.com/package/axios/v/0.27.2)
|
||||||
- [](https://npmjs.com/package/tough-cookie/v/4.1.2)
|
- [](https://npmjs.com/package/tough-cookie/v/4.1.2)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ytmusic-api",
|
"name": "ytmusic-api",
|
||||||
"version": "5.0.3",
|
"version": "5.1.0",
|
||||||
"description": "YouTube Music API",
|
"description": "YouTube Music API",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,9 @@ export default class YTMusic {
|
||||||
/**
|
/**
|
||||||
* Initializes the API
|
* Initializes the API
|
||||||
*/
|
*/
|
||||||
public async initialize(cookies?: string) {
|
public async initialize(options?: { cookies?: string; GL?: string; HL?: string }) {
|
||||||
|
const { cookies, GL, HL } = options ?? {}
|
||||||
|
|
||||||
if (cookies) {
|
if (cookies) {
|
||||||
for (const cookieString of cookies.split("; ")) {
|
for (const cookieString of cookies.split("; ")) {
|
||||||
const cookie = Cookie.parse(`${cookieString}`)
|
const cookie = Cookie.parse(`${cookieString}`)
|
||||||
|
|
@ -108,6 +110,13 @@ export default class YTMusic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.config) {
|
||||||
|
this.config = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GL) this.config.GL = GL
|
||||||
|
if (HL) this.config.HL = HL
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue