Compare commits

..

1 Commits

Author SHA1 Message Date
LuanRT
7d71f3d2cd chore: v5.0.4 release 2023-05-10 18:45:39 +00:00
13 changed files with 16 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "youtubei.js",
"version": "5.0.3",
"version": "5.0.4",
"description": "A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).",
"type": "module",
"types": "./dist/src/platform/lib.d.ts",
@@ -73,7 +73,7 @@
"build:esm": "npx tsc",
"build:deno": "npx cpy ./src ./deno && npx cpy ./package.json ./deno && npx replace \".ts';\" \".ts';\" ./deno -r && npx replace '.js\";' '.ts\";' ./deno -r && npx replace \"'https://esm.sh/linkedom';\" \"'https://esm.sh/linkedom';\" ./deno -r && npx replace \"'https://esm.sh/jintr';\" \"'https://esm.sh/jintr';\" ./deno -r && npx replace \"new Jinter\" \"new Jinter\" ./deno -r",
"bundle:node": "npx esbuild ./dist/src/platform/node.js --bundle --target=node10 --keep-names --format=cjs --platform=node --outfile=./bundle/node.cjs --external:jintr --external:undici --external:linkedom --external:tslib --sourcemap --banner:js=\"/* eslint-disable */\"",
"bundle:browser": "npx esbuild ./dist/src/platform/web.js --banner:js=\"/* eslint-disable */\" --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --outfile=./bundle/browser.js --platform=browser",
"bundle:browser": "npx esbuild ./dist/src/platform/web.js --banner:js=\"/* eslint-disable */\" --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser",
"bundle:browser:prod": "npm run bundle:browser -- --outfile=./bundle/browser.min.js --minify",
"prepare": "npm run build",
"watch": "npx tsc --watch"

View File

@@ -20,7 +20,7 @@ import { AccountManager, InteractionManager, PlaylistManager } from './core/mana
import { Feed, TabbedFeed } from './core/mixins/index.ts';
import Proto from './proto/index.ts';
import Constants from './utils/Constants.ts';
import * as Constants from './utils/Constants.ts';
import { InnertubeError, generateRandomString, throwIfMissing } from './utils/Utils.ts';
import {

View File

@@ -1,4 +1,4 @@
import Constants from '../utils/Constants.ts';
import * as Constants from '../utils/Constants.ts';
import { OAuthError, Platform } from '../utils/Utils.ts';
import type Session from './Session.ts';

View File

@@ -1,6 +1,6 @@
import { Platform, getRandomUserAgent, getStringBetweenStrings, PlayerError } from '../utils/Utils.ts';
import Constants from '../utils/Constants.ts';
import * as Constants from '../utils/Constants.ts';
import type { ICache } from '../types/Cache.ts';
import type { FetchFunction } from '../types/PlatformShim.ts';

View File

@@ -1,4 +1,4 @@
import Constants, { CLIENTS } from '../utils/Constants.ts';
import * as Constants from '../utils/Constants.ts';
import EventEmitterLike from '../utils/EventEmitterLike.ts';
import Actions from './Actions.ts';
import Player from './Player.ts';
@@ -325,7 +325,7 @@ export default class Session extends EventEmitterLike {
screenWidthPoints: 1920,
visitorData: Proto.encodeVisitorData(visitor_id, Math.floor(Date.now() / 1000)),
clientName: options.client_name,
clientVersion: CLIENTS.WEB.VERSION,
clientVersion: Constants.CLIENTS.WEB.VERSION,
osName: 'Windows',
osVersion: '10.0',
platform: options.device_category.toUpperCase(),
@@ -343,7 +343,7 @@ export default class Session extends EventEmitterLike {
}
};
return { context, api_key: CLIENTS.WEB.API_KEY, api_version: CLIENTS.WEB.API_VERSION };
return { context, api_key: Constants.CLIENTS.WEB.API_KEY, api_version: Constants.CLIENTS.WEB.API_VERSION };
}
async signIn(credentials?: Credentials): Promise<void> {

View File

@@ -1,5 +1,5 @@
import Proto from '../../proto/index.ts';
import { Constants } from '../../utils/index.ts';
import * as Constants from '../../utils/Constants.ts';
import { InnertubeError, MissingParamError, Platform } from '../../utils/Utils.ts';
import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Clients.ts';

View File

@@ -1,6 +1,6 @@
import type { ApiResponse } from '../Actions.ts';
import type Actions from '../Actions.ts';
import Constants from '../../utils/Constants.ts';
import * as Constants from '../../utils/Constants.ts';
import type { DownloadOptions, FormatFilter, FormatOptions, URLTransformer } from '../../utils/FormatUtils.ts';
import FormatUtils from '../../utils/FormatUtils.ts';
import { InnertubeError } from '../../utils/Utils.ts';

View File

@@ -1,4 +1,4 @@
import Constants from '../../../utils/Constants.ts';
import * as Constants from '../../../utils/Constants.ts';
import type { YTNode} from '../../helpers.ts';
import { observe, type ObservedArray } from '../../helpers.ts';
import Parser, { type RawNode } from '../../index.ts';

View File

@@ -1,7 +1,7 @@
import type Actions from '../../core/Actions.ts';
import type { ApiResponse } from '../../core/Actions.ts';
import Constants from '../../utils/Constants.ts';
import * as Constants from '../../utils/Constants.ts';
import { InnertubeError } from '../../utils/Utils.ts';
import AutomixPreviewVideo from '../classes/AutomixPreviewVideo.ts';

View File

@@ -78,11 +78,3 @@ export const INNERTUBE_HEADERS_BASE = Object.freeze({
'accept-encoding': 'gzip, deflate',
'content-type': 'application/json'
});
export default {
URLS,
OAUTH,
CLIENTS,
STREAM_HEADERS,
INNERTUBE_HEADERS_BASE
};

View File

@@ -5,7 +5,7 @@ import type Format from '../parser/classes/misc/Format.ts';
import type AudioOnlyPlayability from '../parser/classes/AudioOnlyPlayability.ts';
import type { YTNode } from '../parser/helpers.ts';
import { Constants } from './index.ts';
import * as Constants from './Constants.ts';
import { getStringBetweenStrings, InnertubeError, Platform, streamToIterable } from './Utils.ts';
export type URLTransformer = (url: URL) => URL;

View File

@@ -1,7 +1,7 @@
import type { Context } from '../core/Session.ts';
import type Session from '../core/Session.ts';
import type { FetchFunction } from '../types/PlatformShim.ts';
import Constants from './Constants.ts';
import * as Constants from './Constants.ts';
import {
Platform,
generateSidAuth,

View File

@@ -1,5 +1,6 @@
import { Memo } from '../parser/helpers.ts';
import type { EmojiRun, TextRun } from '../parser/misc.ts';
import { Text } from '../parser/misc.ts';
import type { FetchFunction } from '../types/PlatformShim.ts';
import type PlatformShim from '../types/PlatformShim.ts';
import userAgents from './user-agents.ts';
@@ -47,7 +48,7 @@ export class ChannelError extends Error { }
export function deepCompare(obj1: any, obj2: any): boolean {
const keys = Reflect.ownKeys(obj1);
return keys.some((key) => {
const is_text = obj2[key]?.constructor.name === 'Text';
const is_text = obj2[key] instanceof Text;
if (!is_text && typeof obj2[key] === 'object') {
return JSON.stringify(obj1[key]) === JSON.stringify(obj2[key]);
}