Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iyoutube

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iyoutube - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

4

output/IYoutube.d.ts

@@ -12,3 +12,2 @@ import { Authenticator } from "./Authenticator";

export default class IYoutube {
#private;
rawHttpClient: HTTPClient;

@@ -18,2 +17,4 @@ wrappedHttpClient: WrappedHTTPClient;

authenticator: Authenticator;
explorer: Explorer;
user: User;
constructor(httpClient: HTTPClient, storageAdapater: StorageAdapter);

@@ -25,2 +26,3 @@ init(): Promise<void>;

getVideo(videoId: string): Promise<Video>;
getWhatToWatch(): ContinuatedList;
getExplorer(): Explorer;

@@ -27,0 +29,0 @@ getUser(): User;

@@ -11,19 +11,9 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _IYoutube_explorer, _IYoutube_user;
Object.defineProperty(exports, "__esModule", { value: true });
const Authenticator_1 = require("./Authenticator");
const HTTPClient_1 = require("./interfaces/HTTPClient");
const WrappedHTTPClient_1 = require("./WrappedHTTPClient");
const SearchContinuatedList_1 = require("./fetchers/SearchContinuatedList");
const Explorer_1 = require("./fetchers/Explorer");
const ContinuatedList_1 = require("./fetchers/ContinuatedList");
const User_1 = require("./fetchers/User");

@@ -33,6 +23,5 @@ const Playlist_1 = require("./interfaces/Playlist");

const main_1 = require("./main");
const helpers_1 = require("./fetchers/helpers");
class IYoutube {
constructor(httpClient, storageAdapater) {
_IYoutube_explorer.set(this, void 0);
_IYoutube_user.set(this, void 0);
this.rawHttpClient = httpClient;

@@ -43,4 +32,4 @@ this.wrappedHttpClient = new WrappedHTTPClient_1.WrappedHTTPClient(this.rawHttpClient);

this.wrappedHttpClient.authorizationHeaderCallback = () => { return this.authenticator.getAuthorizationHeader(); };
__classPrivateFieldSet(this, _IYoutube_explorer, new Explorer_1.Explorer(this.wrappedHttpClient, this), "f");
__classPrivateFieldSet(this, _IYoutube_user, new User_1.User(this.wrappedHttpClient, this), "f");
this.explorer = new Explorer_1.Explorer(this.wrappedHttpClient, this);
this.user = new User_1.User(this.wrappedHttpClient, this);
}

@@ -88,7 +77,21 @@ init() {

}
getWhatToWatch() {
return new ContinuatedList_1.ContinuatedList({
url: constants_1.ENDPOINT_BROWSE,
method: HTTPClient_1.HTTPRequestMethod.POST,
data: {
browseId: "FEwhat_to_watch"
}
}, (data) => {
const renderers = helpers_1.default.recursiveSearchForKey("richItemRenderer", data);
let contents = helpers_1.default.recursiveSearchForKey("content", renderers);
contents = contents.flat(1);
return contents;
}, this.wrappedHttpClient, true);
}
getExplorer() {
return __classPrivateFieldGet(this, _IYoutube_explorer, "f");
return this.explorer;
}
getUser() {
return __classPrivateFieldGet(this, _IYoutube_user, "f");
return this.user;
}

@@ -105,2 +108,1 @@ throwErrorIfNotReady() {

exports.default = IYoutube;
_IYoutube_explorer = new WeakMap(), _IYoutube_user = new WeakMap();
{
"name": "iyoutube",
"version": "0.0.21",
"version": "0.0.22",
"description": "The ultimate unofficial YouTube API Client for Javascript",

@@ -5,0 +5,0 @@ "main": "output/main.js",

import { Authenticator } from "./Authenticator";
import { HTTPClient } from "./interfaces/HTTPClient";
import { HTTPClient, HTTPRequestMethod } from "./interfaces/HTTPClient";
import { StorageAdapter } from "./interfaces/StorageAdapter";

@@ -11,4 +11,5 @@ import { WrappedHTTPClient } from "./WrappedHTTPClient";

import { Playlist } from "./interfaces/Playlist";
import { DEBUG } from "./constants";
import { DEBUG, ENDPOINT_BROWSE } from "./constants";
import { Channel, Video } from "./main";
import helpers from "./fetchers/helpers";

@@ -23,4 +24,4 @@ export default class IYoutube {

#explorer : Explorer;
#user : User;
explorer : Explorer;
user : User;

@@ -35,4 +36,4 @@ constructor(httpClient : HTTPClient, storageAdapater : StorageAdapter) {

this.#explorer = new Explorer(this.wrappedHttpClient, this);
this.#user = new User(this.wrappedHttpClient, this);
this.explorer = new Explorer(this.wrappedHttpClient, this);
this.user = new User(this.wrappedHttpClient, this);
}

@@ -75,8 +76,23 @@

getWhatToWatch():ContinuatedList {
return new ContinuatedList({
url: ENDPOINT_BROWSE,
method: HTTPRequestMethod.POST,
data: {
browseId: "FEwhat_to_watch"
}
}, (data:any) => {
const renderers = helpers.recursiveSearchForKey("richItemRenderer", data);
let contents = helpers.recursiveSearchForKey("content", renderers);
contents = contents.flat(1);
return contents;
}, this.wrappedHttpClient, true);
}
getExplorer():Explorer {
return this.#explorer;
return this.explorer;
}
getUser():User {
return this.#user;
return this.user;
}

@@ -83,0 +99,0 @@

@@ -43,4 +43,10 @@ /* Import Library */

var testWhat = ytClient.getWhatToWatch(); //Get the Start Page Video List (what to watch Page)
await testWhat.loadFurhter(); //Load Batch of Videos from List
console.log(testWhat.getVideos().length);
await testWhat.loadFurhter(); //Load Batch of Videos from List
console.log(testWhat.getVideos().length);
// The Video Amount per Batch varies from List Type (e.g Playlist, Search) but also from Randomness of the Youtube API
// Hint: loadFurther() returns the new Videos and adds them to the results at the same Time
})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc