'use strict'; const Axios = require('axios'); const Utils = require('./Utils'); const Constants = require('./Constants'); const EventEmitter = require('events'); const Uuid = require("uuid"); class OAuth extends EventEmitter { constructor(creds) { super(); // Default interval between requests when waiting for authorization. this.refresh_interval = 5; // OAuth URLs: this.oauth_code_url = `${Constants.urls.YT_BASE_URL}/o/oauth2/device/code`; this.oauth_token_url = `${Constants.urls.YT_BASE_URL}/o/oauth2/token`; // Used to check whether an access token is valid or not. this.guide_url = `${Constants.urls.YT_BASE_URL}/youtubei/v1/guide`; // These are always the same, so we shouldn't have any problems for now. this.model_name = Constants.oauth.model_name; this.grant_type = Constants.oauth.grant_type; this.scope = Constants.oauth.scope; // Script that contains important information such as client id and client secret. this.auth_script_regex = /