Ben há 11 meses atrás
pai
commit
54ab85d833

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/bundle.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/bundle.js.map


+ 1 - 1
js/deploy.js

@@ -11,7 +11,7 @@ AWS.config.update({
 const s3 = new AWS.S3();
 const s3 = new AWS.S3();
 
 
 const bucketName = 'justlistenmusic4560.com';
 const bucketName = 'justlistenmusic4560.com';
-const filePath = 'info.js';
+const filePath = 'bundle.js';
 const destinationPath = 'bundle';
 const destinationPath = 'bundle';
 
 
 const fileContent = fs.readFileSync(filePath);
 const fileContent = fs.readFileSync(filePath);

+ 14 - 8
js/info.js

@@ -1,3 +1,5 @@
+console.log('bundle2!')
+
 printable = (platform) => {
 printable = (platform) => {
     return platform === "WEB";
     return platform === "WEB";
 }
 }
@@ -254,10 +256,10 @@ detail = async (url, platform) => {
             throw new Error('JSON not found: ytInitialPlayerResponse');
             throw new Error('JSON not found: ytInitialPlayerResponse');
         }
         }
         const ytInitialPlayerResponse = JSON.parse(match[1]);
         const ytInitialPlayerResponse = JSON.parse(match[1]);
-        const originVideoDetails = ytInitialPlayerResponse['videoDetails'];
         if (printable(platform)) {
         if (printable(platform)) {
-            console.log(`videoDetails: ${JSON.stringify(originVideoDetails)}`);
+            console.log(ytInitialPlayerResponse);
         }
         }
+        const originVideoDetails = ytInitialPlayerResponse['videoDetails'];
         const thumbnails = []
         const thumbnails = []
         for (const item of originVideoDetails['thumbnail']['thumbnails']) {
         for (const item of originVideoDetails['thumbnail']['thumbnails']) {
             thumbnails.push({
             thumbnails.push({
@@ -392,7 +394,7 @@ detail = async (url, platform) => {
         const formats = [];
         const formats = [];
         for (let format of originFormats) {
         for (let format of originFormats) {
             if (printable(platform)) {
             if (printable(platform)) {
-                console.log(`current format: ${JSON.stringify(format)}`);
+                console.log(format);
             }
             }
             if (format && formatIds.indexOf(format['itag']) === -1) {
             if (format && formatIds.indexOf(format['itag']) === -1) {
                 if (!format["url"]) {
                 if (!format["url"]) {
@@ -401,7 +403,7 @@ detail = async (url, platform) => {
                 if (format["url"]) {
                 if (format["url"]) {
                     const {vcodec, acodec} = parseCodecs(format)
                     const {vcodec, acodec} = parseCodecs(format)
                     if (vcodec && acodec) {
                     if (vcodec && acodec) {
-                        formats.push({
+                        const current = {
                             "width": format["width"] + "",
                             "width": format["width"] + "",
                             "height": format["height"] + "",
                             "height": format["height"] + "",
                             "type": format["mimeType"],
                             "type": format["mimeType"],
@@ -417,7 +419,11 @@ detail = async (url, platform) => {
                             "abr": "0",
                             "abr": "0",
                             "container": "mp4_dash",
                             "container": "mp4_dash",
                             "from": format["from"]
                             "from": format["from"]
-                        })
+                        }
+                        if (platform === "WEB") {
+                            current["source"] = format
+                        }
+                        formats.push(current)
                         formatIds.push(format["itag"]);
                         formatIds.push(format["itag"]);
                     }
                     }
                 }
                 }
@@ -429,7 +435,7 @@ detail = async (url, platform) => {
         if (ytInitialDataMatch && ytInitialDataMatch.length === 2) {
         if (ytInitialDataMatch && ytInitialDataMatch.length === 2) {
             const ytInitialData = JSON.parse(ytInitialDataMatch[1]);
             const ytInitialData = JSON.parse(ytInitialDataMatch[1]);
             if (printable(platform)) {
             if (printable(platform)) {
-                console.log(`ytInitialData: ${JSON.stringify(ytInitialData)}`);
+                console.log(ytInitialData);
             }
             }
             for (const item of ytInitialData["contents"]?.["twoColumnWatchNextResults"]?.["secondaryResults"]?.["secondaryResults"]?.["results"] || []) {
             for (const item of ytInitialData["contents"]?.["twoColumnWatchNextResults"]?.["secondaryResults"]?.["secondaryResults"]?.["results"] || []) {
                 if (item["compactVideoRenderer"]) {
                 if (item["compactVideoRenderer"]) {
@@ -513,7 +519,7 @@ search = async (keyword, next, platform) => {
             for (const item of res["onResponseReceivedCommands"][0]["appendContinuationItemsAction"]["continuationItems"][0]["itemSectionRenderer"]["contents"]) {
             for (const item of res["onResponseReceivedCommands"][0]["appendContinuationItemsAction"]["continuationItems"][0]["itemSectionRenderer"]["contents"]) {
                 const video = item["videoRenderer"];
                 const video = item["videoRenderer"];
                 if (printable(platform)) {
                 if (printable(platform)) {
-                    console.log(`search result video: ${JSON.stringify(video)}`);
+                    console.log(video);
                 }
                 }
                 if (video && video["videoId"]) {
                 if (video && video["videoId"]) {
                     videos.push({
                     videos.push({
@@ -564,7 +570,7 @@ search = async (keyword, next, platform) => {
                 if (item["videoRenderer"]) {
                 if (item["videoRenderer"]) {
                     const video = item["videoRenderer"];
                     const video = item["videoRenderer"];
                     if (printable(platform)) {
                     if (printable(platform)) {
-                        console.log(`search result video: ${JSON.stringify(video)}`);
+                        console.log(video);
                     }
                     }
                     if (video && video["videoId"]) {
                     if (video && video["videoId"]) {
                         videos.push({
                         videos.push({

+ 1 - 1
js/main.swift

@@ -139,7 +139,7 @@ func testSearch(keyword: String, ctx: JSContext) -> Void {
 let ctx = createJSContext()
 let ctx = createJSContext()
 
 
 let remote = "https://d3crpuooyqht8f.cloudfront.net/bundle"
 let remote = "https://d3crpuooyqht8f.cloudfront.net/bundle"
-let local = "file:///Users/ben/Desktop/app/be/be-ytb/js/info.js"
+let local = "file:///Users/ben/Desktop/app/be/be-ytb/js/bundle.js"
 
 
 if let url = URL(string: local) {
 if let url = URL(string: local) {
     downloadJSFile(url: url) { result in
     downloadJSFile(url: url) { result in

+ 1 - 1
js/node_modules/@types/node/README.md

@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
 Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
 Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
 
 
 ### Additional Details
 ### Additional Details
- * Last updated: Wed, 08 May 2024 12:09:52 GMT
+ * Last updated: Tue, 14 May 2024 06:09:35 GMT
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
 
 
 # Credits
 # Credits

+ 6 - 6
js/node_modules/@types/node/package.json

@@ -1,8 +1,8 @@
 {
 {
   "_from": "@types/node@*",
   "_from": "@types/node@*",
-  "_id": "@types/node@20.12.11",
+  "_id": "@types/node@20.12.12",
   "_inBundle": false,
   "_inBundle": false,
-  "_integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==",
+  "_integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==",
   "_location": "/@types/node",
   "_location": "/@types/node",
   "_phantomChildren": {},
   "_phantomChildren": {},
   "_requested": {
   "_requested": {
@@ -19,8 +19,8 @@
   "_requiredBy": [
   "_requiredBy": [
     "/jest-worker"
     "/jest-worker"
   ],
   ],
-  "_resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz",
-  "_shasum": "c4ef00d3507000d17690643278a60dc55a9dc9be",
+  "_resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz",
+  "_shasum": "7cbecdf902085cec634fdb362172dfe12b8f2050",
   "_spec": "@types/node@*",
   "_spec": "@types/node@*",
   "_where": "/Users/ben/Desktop/app/be/be-ytb/js/node_modules/jest-worker",
   "_where": "/Users/ben/Desktop/app/be/be-ytb/js/node_modules/jest-worker",
   "bugs": {
   "bugs": {
@@ -202,6 +202,6 @@
   "scripts": {},
   "scripts": {},
   "typeScriptVersion": "4.7",
   "typeScriptVersion": "4.7",
   "types": "index.d.ts",
   "types": "index.d.ts",
-  "typesPublisherContentHash": "3c6750c01df9bf9654e033bbfe80e7598cdc02093dff2896bca92bc4e1911134",
-  "version": "20.12.11"
+  "typesPublisherContentHash": "402e23fae4726c16c2a42ec4d2c7348a15cefadefe71ba6808b89ecca3e73a79",
+  "version": "20.12.12"
 }
 }

+ 50 - 46
js/node_modules/@types/node/stream.d.ts

@@ -2,9 +2,10 @@
  * A stream is an abstract interface for working with streaming data in Node.js.
  * A stream is an abstract interface for working with streaming data in Node.js.
  * The `node:stream` module provides an API for implementing the stream interface.
  * The `node:stream` module provides an API for implementing the stream interface.
  *
  *
- * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances.
+ * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v20.x/api/http.html#class-httpincomingmessage)
+ * and [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) are both stream instances.
  *
  *
- * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
+ * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v20.x/api/events.html#class-eventemitter).
  *
  *
  * To access the `node:stream` module:
  * To access the `node:stream` module:
  *
  *
@@ -41,16 +42,20 @@ declare module "stream" {
     import Readable = internal.Readable;
     import Readable = internal.Readable;
     import ReadableOptions = internal.ReadableOptions;
     import ReadableOptions = internal.ReadableOptions;
     interface ArrayOptions {
     interface ArrayOptions {
-        /** the maximum concurrent invocations of `fn` to call on the stream at once.
+        /**
+         * The maximum concurrent invocations of `fn` to call on the stream at once.
          * @default 1
          * @default 1
          */
          */
         concurrency?: number;
         concurrency?: number;
-        /** allows destroying the stream if the signal is aborted. */
+        /** Allows destroying the stream if the signal is aborted. */
         signal?: AbortSignal;
         signal?: AbortSignal;
     }
     }
     class ReadableBase extends Stream implements NodeJS.ReadableStream {
     class ReadableBase extends Stream implements NodeJS.ReadableStream {
         /**
         /**
          * A utility method for creating Readable Streams out of iterators.
          * A utility method for creating Readable Streams out of iterators.
+         * @since v12.3.0, v10.17.0
+         * @param iterable Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed.
+         * @param options Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`.
          */
          */
         static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
         static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
         /**
         /**
@@ -65,7 +70,7 @@ declare module "stream" {
          */
          */
         readonly readableAborted: boolean;
         readonly readableAborted: boolean;
         /**
         /**
-         * Is `true` if it is safe to call `readable.read()`, which means
+         * Is `true` if it is safe to call {@link read}, which means
          * the stream has not been destroyed or emitted `'error'` or `'end'`.
          * the stream has not been destroyed or emitted `'error'` or `'end'`.
          * @since v11.4.0
          * @since v11.4.0
          */
          */
@@ -77,18 +82,18 @@ declare module "stream" {
          */
          */
         readonly readableDidRead: boolean;
         readonly readableDidRead: boolean;
         /**
         /**
-         * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the `readable.setEncoding()` method.
+         * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the {@link setEncoding} method.
          * @since v12.7.0
          * @since v12.7.0
          */
          */
         readonly readableEncoding: BufferEncoding | null;
         readonly readableEncoding: BufferEncoding | null;
         /**
         /**
-         * Becomes `true` when `'end'` event is emitted.
+         * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v20.x/api/stream.html#event-end) event is emitted.
          * @since v12.9.0
          * @since v12.9.0
          */
          */
         readonly readableEnded: boolean;
         readonly readableEnded: boolean;
         /**
         /**
          * This property reflects the current state of a `Readable` stream as described
          * This property reflects the current state of a `Readable` stream as described
-         * in the `Three states` section.
+         * in the [Three states](https://nodejs.org/docs/latest-v20.x/api/stream.html#three-states) section.
          * @since v9.4.0
          * @since v9.4.0
          */
          */
         readonly readableFlowing: boolean | null;
         readonly readableFlowing: boolean | null;
@@ -134,9 +139,10 @@ declare module "stream" {
          * specified using the `readable.setEncoding()` method or the stream is operating
          * specified using the `readable.setEncoding()` method or the stream is operating
          * in object mode.
          * in object mode.
          *
          *
-         * The optional `size` argument specifies a specific number of bytes to read. If `size` bytes are not available to be read, `null` will be returned _unless_ the stream has ended, in which
-         * case all of the data remaining in the internal
-         * buffer will be returned.
+         * The optional `size` argument specifies a specific number of bytes to read. If
+         * `size` bytes are not available to be read, `null` will be returned _unless_ the
+         * stream has ended, in which case all of the data remaining in the internal buffer
+         * will be returned.
          *
          *
          * If the `size` argument is not specified, all of the data contained in the
          * If the `size` argument is not specified, all of the data contained in the
          * internal buffer will be returned.
          * internal buffer will be returned.
@@ -193,7 +199,7 @@ declare module "stream" {
          * ```
          * ```
          *
          *
          * A `Readable` stream in object mode will always return a single item from
          * A `Readable` stream in object mode will always return a single item from
-         * a call to `readable.read(size)`, regardless of the value of the`size` argument.
+         * a call to `readable.read(size)`, regardless of the value of the `size` argument.
          *
          *
          * If the `readable.read()` method returns a chunk of data, a `'data'` event will
          * If the `readable.read()` method returns a chunk of data, a `'data'` event will
          * also be emitted.
          * also be emitted.
@@ -208,9 +214,9 @@ declare module "stream" {
          * The `readable.setEncoding()` method sets the character encoding for
          * The `readable.setEncoding()` method sets the character encoding for
          * data read from the `Readable` stream.
          * data read from the `Readable` stream.
          *
          *
-         * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data
+         * By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data
          * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the
          * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the
-         * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal
+         * output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal
          * string format.
          * string format.
          *
          *
          * The `Readable` stream will properly handle multi-byte characters delivered
          * The `Readable` stream will properly handle multi-byte characters delivered
@@ -247,7 +253,7 @@ declare module "stream" {
          * });
          * });
          * ```
          * ```
          *
          *
-         * The `readable.pause()` method has no effect if there is a `'readable'`event listener.
+         * The `readable.pause()` method has no effect if there is a `'readable'` event listener.
          * @since v0.9.4
          * @since v0.9.4
          */
          */
         pause(): this;
         pause(): this;
@@ -271,9 +277,9 @@ declare module "stream" {
          */
          */
         resume(): this;
         resume(): this;
         /**
         /**
-         * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most
-         * typical cases, there will be no reason to
-         * use this method directly.
+         * The `readable.isPaused()` method returns the current operating state of the `Readable`. This is
+         * used primarily by the mechanism that underlies the `readable.pipe()` method. In most typical cases,
+         * there will be no reason to use this method directly.
          *
          *
          * ```js
          * ```js
          * const readable = new stream.Readable();
          * const readable = new stream.Readable();
@@ -384,7 +390,7 @@ declare module "stream" {
          * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more
          * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more
          * information.)
          * information.)
          *
          *
-         * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable`
+         * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the `readable.wrap()` method can be used to create a `Readable`
          * stream that uses
          * stream that uses
          * the old stream as its data source.
          * the old stream as its data source.
          *
          *
@@ -567,8 +573,8 @@ declare module "stream" {
         ): Promise<T>;
         ): Promise<T>;
         _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
         _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
         /**
         /**
-         * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
-         * stream will release any internal resources and subsequent calls to `push()`will be ignored.
+         * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable
+         * stream will release any internal resources and subsequent calls to `push()` will be ignored.
          *
          *
          * Once `destroy()` has been called any further calls will be a no-op and no
          * Once `destroy()` has been called any further calls will be a no-op and no
          * further errors except from `_destroy()` may be emitted as `'error'`.
          * further errors except from `_destroy()` may be emitted as `'error'`.
@@ -733,7 +739,7 @@ declare module "stream" {
          * first argument. The `callback` is called asynchronously and before `'error'` is
          * first argument. The `callback` is called asynchronously and before `'error'` is
          * emitted.
          * emitted.
          *
          *
-         * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`.
+         * The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`.
          * If `false` is returned, further attempts to write data to the stream should
          * If `false` is returned, further attempts to write data to the stream should
          * stop until the `'drain'` event is emitted.
          * stop until the `'drain'` event is emitted.
          *
          *
@@ -821,10 +827,10 @@ declare module "stream" {
          *
          *
          * The primary intent of `writable.cork()` is to accommodate a situation in which
          * The primary intent of `writable.cork()` is to accommodate a situation in which
          * several small chunks are written to the stream in rapid succession. Instead of
          * several small chunks are written to the stream in rapid succession. Instead of
-         * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them
+         * immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them
          * all to `writable._writev()`, if present. This prevents a head-of-line blocking
          * all to `writable._writev()`, if present. This prevents a head-of-line blocking
          * situation where data is being buffered while waiting for the first small chunk
          * situation where data is being buffered while waiting for the first small chunk
-         * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput.
+         * to be processed. However, use of `writable.cork()` without implementing `writable._writev()` may have an adverse effect on throughput.
          *
          *
          * See also: `writable.uncork()`, `writable._writev()`.
          * See also: `writable.uncork()`, `writable._writev()`.
          * @since v0.11.2
          * @since v0.11.2
@@ -834,7 +840,7 @@ declare module "stream" {
          * The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
          * The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
          *
          *
          * When using `writable.cork()` and `writable.uncork()` to manage the buffering
          * When using `writable.cork()` and `writable.uncork()` to manage the buffering
-         * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event
+         * of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event
          * loop phase.
          * loop phase.
          *
          *
          * ```js
          * ```js
@@ -865,10 +871,10 @@ declare module "stream" {
          */
          */
         uncork(): void;
         uncork(): void;
         /**
         /**
-         * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable
+         * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable
          * stream has ended and subsequent calls to `write()` or `end()` will result in
          * stream has ended and subsequent calls to `write()` or `end()` will result in
          * an `ERR_STREAM_DESTROYED` error.
          * an `ERR_STREAM_DESTROYED` error.
-         * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.
+         * This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.
          * Use `end()` instead of destroy if data should flush before close, or wait for
          * Use `end()` instead of destroy if data should flush before close, or wait for
          * the `'drain'` event before destroying the stream.
          * the `'drain'` event before destroying the stream.
          *
          *
@@ -1063,8 +1069,8 @@ declare module "stream" {
              * readable side ends. Set initially by the `allowHalfOpen` constructor option,
              * readable side ends. Set initially by the `allowHalfOpen` constructor option,
              * which defaults to `true`.
              * which defaults to `true`.
              *
              *
-             * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is
-             * emitted.
+             * This can be changed manually to change the half-open behavior of an existing
+             * `Duplex` stream instance, but must be changed before the `'end'` event is emitted.
              * @since v0.9.4
              * @since v0.9.4
              */
              */
             allowHalfOpen: boolean;
             allowHalfOpen: boolean;
@@ -1285,7 +1291,7 @@ declare module "stream" {
         }
         }
         /**
         /**
          * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is
          * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is
-         * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams.
+         * primarily for examples and testing, but there are some use cases where `stream.PassThrough` is useful as a building block for novel sorts of streams.
          */
          */
         class PassThrough extends Transform {}
         class PassThrough extends Transform {}
         /**
         /**
@@ -1294,8 +1300,8 @@ declare module "stream" {
          * Attaches an AbortSignal to a readable or writeable stream. This lets code
          * Attaches an AbortSignal to a readable or writeable stream. This lets code
          * control stream destruction using an `AbortController`.
          * control stream destruction using an `AbortController`.
          *
          *
-         * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new
-         * AbortError())` for webstreams.
+         * Calling `abort` on the `AbortController` corresponding to the passed `AbortSignal` will behave the same way as
+         * calling `.destroy(new AbortError())` on the stream, and `controller.error(new AbortError())` for webstreams.
          *
          *
          * ```js
          * ```js
          * const fs = require('node:fs');
          * const fs = require('node:fs');
@@ -1365,20 +1371,18 @@ declare module "stream" {
          * ```
          * ```
          * @since v15.4.0
          * @since v15.4.0
          * @param signal A signal representing possible cancellation
          * @param signal A signal representing possible cancellation
-         * @param stream a stream to attach a signal to
+         * @param stream A stream to attach a signal to.
          */
          */
         function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
         function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
         /**
         /**
          * Returns the default highWaterMark used by streams.
          * Returns the default highWaterMark used by streams.
          * Defaults to `16384` (16 KiB), or `16` for `objectMode`.
          * Defaults to `16384` (16 KiB), or `16` for `objectMode`.
          * @since v19.9.0
          * @since v19.9.0
-         * @param objectMode
          */
          */
         function getDefaultHighWaterMark(objectMode: boolean): number;
         function getDefaultHighWaterMark(objectMode: boolean): number;
         /**
         /**
          * Sets the default highWaterMark used by streams.
          * Sets the default highWaterMark used by streams.
          * @since v19.9.0
          * @since v19.9.0
-         * @param objectMode
          * @param value highWaterMark value
          * @param value highWaterMark value
          */
          */
         function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
         function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
@@ -1411,11 +1415,11 @@ declare module "stream" {
          * ```
          * ```
          *
          *
          * Especially useful in error handling scenarios where a stream is destroyed
          * Especially useful in error handling scenarios where a stream is destroyed
-         * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`.
+         * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`.
          *
          *
-         * The `finished` API provides `promise version`.
+         * The `finished` API provides [promise version](https://nodejs.org/docs/latest-v20.x/api/stream.html#streamfinishedstream-options).
          *
          *
-         * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
+         * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
          * invoked. The reason for this is so that unexpected `'error'` events (due to
          * invoked. The reason for this is so that unexpected `'error'` events (due to
          * incorrect stream implementations) do not cause unexpected crashes.
          * incorrect stream implementations) do not cause unexpected crashes.
          * If this is unwanted behavior then the returned cleanup function needs to be
          * If this is unwanted behavior then the returned cleanup function needs to be
@@ -1430,7 +1434,7 @@ declare module "stream" {
          * @since v10.0.0
          * @since v10.0.0
          * @param stream A readable and/or writable stream.
          * @param stream A readable and/or writable stream.
          * @param callback A callback function that takes an optional error argument.
          * @param callback A callback function that takes an optional error argument.
-         * @return A cleanup function which removes all registered listeners.
+         * @returns A cleanup function which removes all registered listeners.
          */
          */
         function finished(
         function finished(
             stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
             stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
@@ -1501,7 +1505,7 @@ declare module "stream" {
          * );
          * );
          * ```
          * ```
          *
          *
-         * The `pipeline` API provides a `promise version`.
+         * The `pipeline` API provides a [promise version](https://nodejs.org/docs/latest-v20.x/api/stream.html#streampipelinesource-transforms-destination-options).
          *
          *
          * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
          * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
          *
          *
@@ -1541,7 +1545,7 @@ declare module "stream" {
         function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
         function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
             source: A,
             source: A,
             destination: B,
             destination: B,
-            callback?: PipelineCallback<B>,
+            callback: PipelineCallback<B>,
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         function pipeline<
         function pipeline<
             A extends PipelineSource<any>,
             A extends PipelineSource<any>,
@@ -1551,7 +1555,7 @@ declare module "stream" {
             source: A,
             source: A,
             transform1: T1,
             transform1: T1,
             destination: B,
             destination: B,
-            callback?: PipelineCallback<B>,
+            callback: PipelineCallback<B>,
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         function pipeline<
         function pipeline<
             A extends PipelineSource<any>,
             A extends PipelineSource<any>,
@@ -1563,7 +1567,7 @@ declare module "stream" {
             transform1: T1,
             transform1: T1,
             transform2: T2,
             transform2: T2,
             destination: B,
             destination: B,
-            callback?: PipelineCallback<B>,
+            callback: PipelineCallback<B>,
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         function pipeline<
         function pipeline<
             A extends PipelineSource<any>,
             A extends PipelineSource<any>,
@@ -1577,7 +1581,7 @@ declare module "stream" {
             transform2: T2,
             transform2: T2,
             transform3: T3,
             transform3: T3,
             destination: B,
             destination: B,
-            callback?: PipelineCallback<B>,
+            callback: PipelineCallback<B>,
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         function pipeline<
         function pipeline<
             A extends PipelineSource<any>,
             A extends PipelineSource<any>,
@@ -1593,11 +1597,11 @@ declare module "stream" {
             transform3: T3,
             transform3: T3,
             transform4: T4,
             transform4: T4,
             destination: B,
             destination: B,
-            callback?: PipelineCallback<B>,
+            callback: PipelineCallback<B>,
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
         function pipeline(
         function pipeline(
             streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
             streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
-            callback?: (err: NodeJS.ErrnoException | null) => void,
+            callback: (err: NodeJS.ErrnoException | null) => void,
         ): NodeJS.WritableStream;
         ): NodeJS.WritableStream;
         function pipeline(
         function pipeline(
             stream1: NodeJS.ReadableStream,
             stream1: NodeJS.ReadableStream,

+ 0 - 9
js/node_modules/fs/README.md

@@ -1,9 +0,0 @@
-# Security holding package
-
-This package name is not currently in use, but was formerly occupied
-by another package. To avoid malicious use, npm is hanging on to the
-package name, but loosely, and we'll probably give it to you if you
-want it.
-
-You may adopt this package by contacting support@npmjs.com and
-requesting the name.

+ 0 - 46
js/node_modules/fs/package.json

@@ -1,46 +0,0 @@
-{
-  "_from": "fs@0.0.1-security",
-  "_id": "fs@0.0.1-security",
-  "_inBundle": false,
-  "_integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==",
-  "_location": "/fs",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "fs@0.0.1-security",
-    "name": "fs",
-    "escapedName": "fs",
-    "rawSpec": "0.0.1-security",
-    "saveSpec": null,
-    "fetchSpec": "0.0.1-security"
-  },
-  "_requiredBy": [
-    "#DEV:/",
-    "#USER"
-  ],
-  "_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
-  "_shasum": "8a7bd37186b6dddf3813f23858b57ecaaf5e41d4",
-  "_spec": "fs@0.0.1-security",
-  "_where": "/Users/ben/Desktop/app/be/be-ytb/js",
-  "author": "",
-  "bugs": {
-    "url": "https://github.com/npm/security-holder/issues"
-  },
-  "bundleDependencies": false,
-  "deprecated": false,
-  "description": "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.",
-  "homepage": "https://github.com/npm/security-holder#readme",
-  "keywords": [],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "fs",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/security-holder.git"
-  },
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "version": "0.0.1-security"
-}

+ 9 - 7
js/node_modules/terser-webpack-plugin/package.json

@@ -1,5 +1,5 @@
 {
 {
-  "_from": "terser-webpack-plugin@^5.3.10",
+  "_from": "terser-webpack-plugin",
   "_id": "terser-webpack-plugin@5.3.10",
   "_id": "terser-webpack-plugin@5.3.10",
   "_inBundle": false,
   "_inBundle": false,
   "_integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==",
   "_integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==",
@@ -10,22 +10,24 @@
     "ajv-keywords": "3.5.2"
     "ajv-keywords": "3.5.2"
   },
   },
   "_requested": {
   "_requested": {
-    "type": "range",
+    "type": "tag",
     "registry": true,
     "registry": true,
-    "raw": "terser-webpack-plugin@^5.3.10",
+    "raw": "terser-webpack-plugin",
     "name": "terser-webpack-plugin",
     "name": "terser-webpack-plugin",
     "escapedName": "terser-webpack-plugin",
     "escapedName": "terser-webpack-plugin",
-    "rawSpec": "^5.3.10",
+    "rawSpec": "",
     "saveSpec": null,
     "saveSpec": null,
-    "fetchSpec": "^5.3.10"
+    "fetchSpec": "latest"
   },
   },
   "_requiredBy": [
   "_requiredBy": [
+    "#DEV:/",
+    "#USER",
     "/webpack"
     "/webpack"
   ],
   ],
   "_resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz",
   "_resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz",
   "_shasum": "904f4c9193c6fd2a03f693a2150c62a92f40d199",
   "_shasum": "904f4c9193c6fd2a03f693a2150c62a92f40d199",
-  "_spec": "terser-webpack-plugin@^5.3.10",
-  "_where": "/Users/ben/Desktop/app/be/be-ytb/js/node_modules/webpack",
+  "_spec": "terser-webpack-plugin",
+  "_where": "/Users/ben/Desktop/app/be/be-ytb/js",
   "author": {
   "author": {
     "name": "webpack Contrib Team"
     "name": "webpack Contrib Team"
   },
   },

+ 3 - 9
js/package-lock.json

@@ -92,9 +92,9 @@
       "dev": true
       "dev": true
     },
     },
     "@types/node": {
     "@types/node": {
-      "version": "20.12.11",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz",
-      "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==",
+      "version": "20.12.12",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz",
+      "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==",
       "dev": true,
       "dev": true,
       "requires": {
       "requires": {
         "undici-types": "~5.26.4"
         "undici-types": "~5.26.4"
@@ -756,12 +756,6 @@
         "readable-stream": "^2.0.0"
         "readable-stream": "^2.0.0"
       }
       }
     },
     },
-    "fs": {
-      "version": "0.0.1-security",
-      "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
-      "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==",
-      "dev": true
-    },
     "fs-write-stream-atomic": {
     "fs-write-stream-atomic": {
       "version": "1.0.10",
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
       "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",

+ 1 - 0
js/package.json

@@ -12,6 +12,7 @@
   "license": "ISC",
   "license": "ISC",
   "devDependencies": {
   "devDependencies": {
     "aws-sdk": "^2.1618.0",
     "aws-sdk": "^2.1618.0",
+    "terser-webpack-plugin": "^5.3.10",
     "uglifyjs-webpack-plugin": "^2.2.0",
     "uglifyjs-webpack-plugin": "^2.2.0",
     "webpack": "^5.91.0",
     "webpack": "^5.91.0",
     "webpack-cli": "^5.1.4"
     "webpack-cli": "^5.1.4"

+ 10 - 22
js/webpack.config.js

@@ -1,20 +1,5 @@
 const path = require('path');
 const path = require('path');
-
-function getCurrentDateTime() {
-    var currentDate = new Date();
-
-    var year = currentDate.getFullYear().toString();
-    var month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
-    var day = currentDate.getDate().toString().padStart(2, '0');
-
-    var hours = currentDate.getHours().toString().padStart(2, '0');
-    var minutes = currentDate.getMinutes().toString().padStart(2, '0');
-    var seconds = currentDate.getSeconds().toString().padStart(2, '0');
-
-    return year + month + day + hours + minutes + seconds;
-}
-
-const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+const TerserPlugin = require('terser-webpack-plugin');
 
 
 module.exports = {
 module.exports = {
     entry: './info.js',
     entry: './info.js',
@@ -24,13 +9,16 @@ module.exports = {
     },
     },
     optimization: {
     optimization: {
         minimizer: [
         minimizer: [
-            new UglifyJsPlugin({
-                uglifyOptions: {
-                    compress: {
-                        drop_console: true
-                    },
-                    keep_fnames: true,
+            new TerserPlugin({
+                terserOptions: {
+                    // 启用代码混淆
                     mangle: true,
                     mangle: true,
+                    // 压缩选项
+                    compress: {
+                        // 在混淆代码中保留类、函数名等标识符的长度
+                        keep_classnames: true,
+                        keep_fnames: true
+                    }
                 },
                 },
             }),
             }),
         ],
         ],

+ 1 - 1
test.py

@@ -8,7 +8,7 @@ with yt_dlp.YoutubeDL({
     'proxy': 'socks://127.0.0.1:8889',
     'proxy': 'socks://127.0.0.1:8889',
     'nocheckcertificate': True
     'nocheckcertificate': True
 }) as ydl:
 }) as ydl:
-    info = ydl.extract_info("https://www.youtube.com/watch?v=IXuhdnB2dAY", download=False)
+    info = ydl.extract_info("https://www.youtube.com/watch?v=5qm8PH4xAss", download=False)
     formats = []
     formats = []
     for item in info["formats"]:
     for item in info["formats"]:
         if item.get("resolution") != "audio only" and item.get("url") and item.get("acodec") and item.get(
         if item.get("resolution") != "audio only" and item.get("url") and item.get("acodec") and item.get(

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff