mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-13 17:42:18 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
beb4733e84 | ||
|
|
66b026bf49 | ||
|
|
26734194ab | ||
|
|
38a83c3c2a | ||
|
|
b1f19f16ac | ||
|
|
891d889408 | ||
|
|
d4adb9eb6b | ||
|
|
3b0498b68b | ||
|
|
154a5d2868 | ||
|
|
7c0abfccd7 |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -1,5 +1,28 @@
|
||||
# Changelog
|
||||
|
||||
## [5.0.4](https://github.com/LuanRT/YouTube.js/compare/v5.0.3...v5.0.4) (2023-05-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bundles:** Use ESM tslib build for the browser bundles ([#397](https://github.com/LuanRT/YouTube.js/issues/397)) ([2673419](https://github.com/LuanRT/YouTube.js/commit/26734194ab0bc5a9f57e1c509d7646ce8903d0c6))
|
||||
* **Utils:** Circular dependency introduced in 38a83c3c2aa814150d1d9b8ed99fca915c1d67fe ([#400](https://github.com/LuanRT/YouTube.js/issues/400)) ([66b026b](https://github.com/LuanRT/YouTube.js/commit/66b026bf493d71a39e12825938fe54dc63aefd16))
|
||||
* **Utils:** Use instanceof in deepCompare instead of the constructor name ([#398](https://github.com/LuanRT/YouTube.js/issues/398)) ([38a83c3](https://github.com/LuanRT/YouTube.js/commit/38a83c3c2aa814150d1d9b8ed99fca915c1d67fe))
|
||||
|
||||
## [5.0.3](https://github.com/LuanRT/YouTube.js/compare/v5.0.2...v5.0.3) (2023-05-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Video:** typo causing node parsing to fail ([3b0498b](https://github.com/LuanRT/YouTube.js/commit/3b0498b68b5378e63283e792bd45571c0b919e0b))
|
||||
|
||||
## [5.0.2](https://github.com/LuanRT/YouTube.js/compare/v5.0.1...v5.0.2) (2023-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **VideoInfo:** Use microformat view_count when videoDetails view_count is NaN ([#393](https://github.com/LuanRT/YouTube.js/issues/393)) ([7c0abfc](https://github.com/LuanRT/YouTube.js/commit/7c0abfccd78a6c291d898f898d73a4f16170e2a9))
|
||||
|
||||
## [5.0.1](https://github.com/LuanRT/YouTube.js/compare/v5.0.0...v5.0.1) (2023-04-30)
|
||||
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "youtubei.js",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "youtubei.js",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.4",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/LuanRT"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "youtubei.js",
|
||||
"version": "5.0.1",
|
||||
"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 \".js';\" \".ts';\" ./deno -r && npx replace '.js\";' '.ts\";' ./deno -r && npx replace \"'linkedom';\" \"'https://esm.sh/linkedom';\" ./deno -r && npx replace \"'jintr';\" \"'https://esm.sh/jintr';\" ./deno -r && npx replace \"new Jinter.default\" \"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"
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AccountManager, InteractionManager, PlaylistManager } from './core/mana
|
||||
import { Feed, TabbedFeed } from './core/mixins/index.js';
|
||||
|
||||
import Proto from './proto/index.js';
|
||||
import Constants from './utils/Constants.js';
|
||||
import * as Constants from './utils/Constants.js';
|
||||
import { InnertubeError, generateRandomString, throwIfMissing } from './utils/Utils.js';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Constants from '../utils/Constants.js';
|
||||
import * as Constants from '../utils/Constants.js';
|
||||
import { OAuthError, Platform } from '../utils/Utils.js';
|
||||
import type Session from './Session.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Platform, getRandomUserAgent, getStringBetweenStrings, PlayerError } from '../utils/Utils.js';
|
||||
|
||||
import Constants from '../utils/Constants.js';
|
||||
import * as Constants from '../utils/Constants.js';
|
||||
|
||||
import type { ICache } from '../types/Cache.js';
|
||||
import type { FetchFunction } from '../types/PlatformShim.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Constants, { CLIENTS } from '../utils/Constants.js';
|
||||
import * as Constants from '../utils/Constants.js';
|
||||
import EventEmitterLike from '../utils/EventEmitterLike.js';
|
||||
import Actions from './Actions.js';
|
||||
import Player from './Player.js';
|
||||
@@ -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> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Proto from '../../proto/index.js';
|
||||
import { Constants } from '../../utils/index.js';
|
||||
import * as Constants from '../../utils/Constants.js';
|
||||
import { InnertubeError, MissingParamError, Platform } from '../../utils/Utils.js';
|
||||
|
||||
import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Clients.js';
|
||||
|
||||
@@ -28,6 +28,9 @@ export function build(opts: PlayerEndpointOptions): IPlayerRequest {
|
||||
}
|
||||
}
|
||||
},
|
||||
attestationRequest: {
|
||||
omitBotguardData: true
|
||||
},
|
||||
racyCheckOk: true,
|
||||
contentCheckOk: true,
|
||||
videoId: opts.video_id,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ApiResponse } from '../Actions.js';
|
||||
import type Actions from '../Actions.js';
|
||||
import Constants from '../../utils/Constants.js';
|
||||
import * as Constants from '../../utils/Constants.js';
|
||||
import type { DownloadOptions, FormatFilter, FormatOptions, URLTransformer } from '../../utils/FormatUtils.js';
|
||||
import FormatUtils from '../../utils/FormatUtils.js';
|
||||
import { InnertubeError } from '../../utils/Utils.js';
|
||||
|
||||
@@ -53,7 +53,7 @@ export default class Video extends YTNode {
|
||||
this.description_snippet = new Text(data.descriptionSnippet);
|
||||
}
|
||||
|
||||
if (Reflect.has(data, 'detaildMetadataSnippets')) {
|
||||
if (Reflect.has(data, 'detailedMetadataSnippets')) {
|
||||
this.snippets = data.detailedMetadataSnippets.map((snippet: RawNode) => ({
|
||||
text: new Text(snippet.snippetText),
|
||||
hover_text: new Text(snippet.snippetHoverText)
|
||||
@@ -127,4 +127,4 @@ export default class Video extends YTNode {
|
||||
get best_thumbnail(): Thumbnail | undefined {
|
||||
return this.thumbnails[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Constants from '../../../utils/Constants.js';
|
||||
import * as Constants from '../../../utils/Constants.js';
|
||||
import type { YTNode} from '../../helpers.js';
|
||||
import { observe, type ObservedArray } from '../../helpers.js';
|
||||
import Parser, { type RawNode } from '../../index.js';
|
||||
|
||||
@@ -83,7 +83,8 @@ class VideoInfo extends MediaInfo {
|
||||
is_family_safe: info.microformat?.is_family_safe,
|
||||
category: info.microformat?.is(PlayerMicroformat) ? info.microformat?.category : null,
|
||||
has_ypc_metadata: info.microformat?.is(PlayerMicroformat) ? info.microformat?.has_ypc_metadata : null,
|
||||
start_timestamp: info.microformat?.is(PlayerMicroformat) ? info.microformat.start_timestamp : null
|
||||
start_timestamp: info.microformat?.is(PlayerMicroformat) ? info.microformat.start_timestamp : null,
|
||||
view_count: info.microformat?.is(PlayerMicroformat) && isNaN(info.video_details?.view_count as number) ? info.microformat.view_count : info.video_details?.view_count
|
||||
},
|
||||
like_count: undefined as number | undefined,
|
||||
is_liked: undefined as boolean | undefined,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type Actions from '../../core/Actions.js';
|
||||
import type { ApiResponse } from '../../core/Actions.js';
|
||||
|
||||
import Constants from '../../utils/Constants.js';
|
||||
import * as Constants from '../../utils/Constants.js';
|
||||
import { InnertubeError } from '../../utils/Utils.js';
|
||||
|
||||
import AutomixPreviewVideo from '../classes/AutomixPreviewVideo.js';
|
||||
|
||||
@@ -20,6 +20,9 @@ export interface IPlayerRequest {
|
||||
lactMilliseconds: string;
|
||||
}
|
||||
},
|
||||
attestationRequest: {
|
||||
omitBotguardData: boolean;
|
||||
},
|
||||
videoId: string;
|
||||
racyCheckOk: boolean;
|
||||
contentCheckOk: boolean;
|
||||
|
||||
@@ -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
|
||||
};
|
||||
@@ -5,7 +5,7 @@ import type Format from '../parser/classes/misc/Format.js';
|
||||
import type AudioOnlyPlayability from '../parser/classes/AudioOnlyPlayability.js';
|
||||
import type { YTNode } from '../parser/helpers.js';
|
||||
|
||||
import { Constants } from './index.js';
|
||||
import * as Constants from './Constants.js';
|
||||
import { getStringBetweenStrings, InnertubeError, Platform, streamToIterable } from './Utils.js';
|
||||
|
||||
export type URLTransformer = (url: URL) => URL;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Context } from '../core/Session.js';
|
||||
import type Session from '../core/Session.js';
|
||||
import type { FetchFunction } from '../types/PlatformShim.js';
|
||||
import Constants from './Constants.js';
|
||||
import * as Constants from './Constants.js';
|
||||
import {
|
||||
Platform,
|
||||
generateSidAuth,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Memo } from '../parser/helpers.js';
|
||||
import type { EmojiRun, TextRun } from '../parser/misc.js';
|
||||
import { Text } from '../parser/misc.js';
|
||||
import type { FetchFunction } from '../types/PlatformShim.js';
|
||||
import type PlatformShim from '../types/PlatformShim.js';
|
||||
import userAgents from './user-agents.js';
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user