Skip to content

Commit f59cfc7

Browse files
author
zS1L3NT Mac
committed
✨ add ability to change locale
1 parent 0c9137a commit f59cfc7

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ $ bun test
6262
- [![eslint-plugin-simple-import-sort](https://img.shields.io/badge/eslint--plugin--simple--import--sort-latest-red?style=flat-square)](https://npmjs.com/package/eslint-plugin-simple-import-sort/v/latest)
6363
- [![prettier](https://img.shields.io/badge/prettier-latest-red?style=flat-square)](https://npmjs.com/package/prettier/v/latest)
6464
- Miscellaneous
65-
- [![arktype](https://img.shields.io/badge/arktype-%5E1.0.28--alpha-red?style=flat-square)](https://npmjs.com/package/arktype/v/1.0.28-alpha)
65+
- [![arktype](https://img.shields.io/badge/arktype-%5E1.0.29--alpha-red?style=flat-square)](https://npmjs.com/package/arktype/v/1.0.29-alpha)
6666
- [![axios](https://img.shields.io/badge/axios-%5E0.27.2-red?style=flat-square)](https://npmjs.com/package/axios/v/0.27.2)
6767
- [![tough-cookie](https://img.shields.io/badge/tough--cookie-%5E4.1.2-red?style=flat-square)](https://npmjs.com/package/tough-cookie/v/4.1.2)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ytmusic-api",
3-
"version": "5.0.3",
3+
"version": "5.1.0",
44
"description": "YouTube Music API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/YTMusic.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export default class YTMusic {
7777
/**
7878
* Initializes the API
7979
*/
80-
public async initialize(cookies?: string) {
80+
public async initialize(options?: { cookies?: string; GL?: string; HL?: string }) {
81+
const { cookies, GL, HL } = options ?? {}
82+
8183
if (cookies) {
8284
for (const cookieString of cookies.split("; ")) {
8385
const cookie = Cookie.parse(`${cookieString}`)
@@ -108,6 +110,13 @@ export default class YTMusic {
108110
}
109111
}
110112

113+
if (!this.config) {
114+
this.config = {}
115+
}
116+
117+
if (GL) this.config.GL = GL
118+
if (HL) this.config.HL = HL
119+
111120
return this
112121
}
113122

0 commit comments

Comments
 (0)