add Region settings :3

This commit is contained in:
Ashley 2023-09-23 15:33:30 +00:00
parent 87bdb45f0e
commit c7a2c08bbb

View file

@ -63,7 +63,7 @@ class PokeTubeCore {
* @param {string} v - Video ID.
* @returns {Promise<object>} Promise resolving to the video information.
*/
async video(v) {
async video(v, contentlang, contentregion) {
const { fetch } = await import("undici");
@ -79,8 +79,8 @@ class PokeTubeCore {
try {
const [invComments, videoInfo, videoData] = await Promise.all([
fetch(`${this.config.invapi}/comments/${v}?${this.language}`).then((res) => res.text()),
fetch(`${this.config.invapi}/videos/${v}`).then((res) => res.text()),
fetch(`${this.config.invapi}/comments/${v}?hl=${contentlang}&region=${contentregion}`).then((res) => res.text()),
fetch(`${this.config.invapi}/videos/${v}?hl=${contentlang}&region=${contentregion}`).then((res) => res.text()),
curly
.get(`${this.config.tubeApi}video?v=${v}`, {
httpHeader: Object.entries(headers).map(([k, v]) => `${k}: ${v}`),