Comparing version 0.0.15 to 0.0.16
@@ -60,1 +60,3 @@ export declare const DEBUG = false; | ||
export declare const ENDPOINT_ADDTOPLAYLIST = "https://www.youtube.com/youtubei/v1/playlist/get_add_to_playlist"; | ||
export declare const ENDPOINT_NEXT = "https://www.youtube.com/youtubei/v1/next"; | ||
export declare const ENDPOINT_COMMENT_ACTION = "https://www.youtube.com/youtubei/v1/comment/perform_comment_action"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ENDPOINT_ADDTOPLAYLIST = exports.ENDPOINT_UNSUBSCRIBE = exports.ENDPOINT_SUBSCRIBE = exports.ENDPOINT_REMOVELIKE = exports.ENDPOINT_DISLIKE = exports.ENDPOINT_LIKE = exports.ENDPOINT_SEARCH = exports.ENDPOINT_BROWSE = exports.CONSOLE_COLORS = exports.DEFAULT_CONTEXT = exports.DEFAULT_USER_AGENT = exports.DEFAULT_CLIENT_NAME = exports.DEFAULT_CLIENT_VERSION = exports.DEFAULT_API_KEY = exports.DEBUG = void 0; | ||
exports.ENDPOINT_COMMENT_ACTION = exports.ENDPOINT_NEXT = exports.ENDPOINT_ADDTOPLAYLIST = exports.ENDPOINT_UNSUBSCRIBE = exports.ENDPOINT_SUBSCRIBE = exports.ENDPOINT_REMOVELIKE = exports.ENDPOINT_DISLIKE = exports.ENDPOINT_LIKE = exports.ENDPOINT_SEARCH = exports.ENDPOINT_BROWSE = exports.CONSOLE_COLORS = exports.DEFAULT_CONTEXT = exports.DEFAULT_USER_AGENT = exports.DEFAULT_CLIENT_NAME = exports.DEFAULT_CLIENT_VERSION = exports.DEFAULT_API_KEY = exports.DEBUG = void 0; | ||
exports.DEBUG = false; | ||
@@ -63,1 +63,3 @@ exports.DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"; | ||
exports.ENDPOINT_ADDTOPLAYLIST = "https://www.youtube.com/youtubei/v1/playlist/get_add_to_playlist"; | ||
exports.ENDPOINT_NEXT = "https://www.youtube.com/youtubei/v1/next"; | ||
exports.ENDPOINT_COMMENT_ACTION = "https://www.youtube.com/youtubei/v1/comment/perform_comment_action"; |
@@ -1,15 +0,18 @@ | ||
/// <reference types="node" /> | ||
import { Channel } from "diagnostics_channel"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { HTTPRequestOptions } from "../interfaces/HTTPClient"; | ||
import { Playlist } from "../interfaces/Playlist"; | ||
import { Video } from "../interfaces/Video"; | ||
import { Video, Channel, Playlist, Comment, CommentThread } from "../main"; | ||
export declare class ContinuatedList { | ||
#private; | ||
results: Array<Video | Channel | Playlist>; | ||
results: Array<Video | Channel | Playlist | Comment | CommentThread>; | ||
endReached: boolean; | ||
continuationToken: string; | ||
onlyContinuation: boolean; | ||
constructor(requestOptions: HTTPRequestOptions, dataprocessor: Function, httpclient: WrappedHTTPClient, onlyContinuation?: boolean); | ||
loadFurhter(): Promise<any>; | ||
getByType(type: typeof Video | typeof Playlist | typeof Channel): (Video | Playlist | Channel)[]; | ||
getByType(type: any): (Video | Channel | Playlist | Comment | CommentThread)[]; | ||
getVideos(): Array<Video>; | ||
getPlaylists(): Array<Playlist>; | ||
getChannels(): Array<Channel>; | ||
getComments(): Array<Comment>; | ||
getCommentThreads(): Array<CommentThread>; | ||
} |
@@ -22,6 +22,7 @@ "use strict"; | ||
}; | ||
var _ContinuatedList_requestOptions, _ContinuatedList_httpclient, _ContinuatedList_dataprocessor, _ContinuatedList_continuationToken; | ||
var _ContinuatedList_requestOptions, _ContinuatedList_httpclient, _ContinuatedList_dataprocessor; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContinuatedList = void 0; | ||
const helpers_1 = require("./helpers"); | ||
const main_1 = require("../main"); | ||
class ContinuatedList { | ||
@@ -33,3 +34,3 @@ constructor(requestOptions, dataprocessor, httpclient, onlyContinuation) { | ||
_ContinuatedList_dataprocessor.set(this, void 0); | ||
_ContinuatedList_continuationToken.set(this, ""); | ||
this.continuationToken = ""; | ||
this.onlyContinuation = false; | ||
@@ -48,7 +49,10 @@ __classPrivateFieldSet(this, _ContinuatedList_requestOptions, requestOptions, "f"); | ||
var joinedData = __classPrivateFieldGet(this, _ContinuatedList_requestOptions, "f").data; | ||
if (__classPrivateFieldGet(this, _ContinuatedList_continuationToken, "f") != "") { | ||
joinedData.continuation = __classPrivateFieldGet(this, _ContinuatedList_continuationToken, "f"); | ||
if (this.onlyContinuation) { | ||
delete joinedData["browseId"]; | ||
} | ||
if (!joinedData) | ||
joinedData = {}; | ||
if (this.continuationToken != "") { | ||
joinedData.continuation = this.continuationToken; | ||
if (this.onlyContinuation) | ||
joinedData = { | ||
continuation: this.continuationToken | ||
}; | ||
} | ||
@@ -65,3 +69,3 @@ var res = yield __classPrivateFieldGet(this, _ContinuatedList_httpclient, "f").request({ | ||
if (continuationCommand) | ||
__classPrivateFieldSet(this, _ContinuatedList_continuationToken, continuationCommand.token, "f"); | ||
this.continuationToken = continuationCommand.token; | ||
else | ||
@@ -76,7 +80,21 @@ this.endReached = true; | ||
getByType(type) { | ||
const refactoredType = type; | ||
return this.results.filter((elem) => { return elem instanceof refactoredType; }); | ||
return this.results.filter((elem) => { return elem instanceof type; }); | ||
} | ||
getVideos() { | ||
return this.getByType(main_1.Video); | ||
} | ||
getPlaylists() { | ||
return this.getByType(main_1.Playlist); | ||
} | ||
getChannels() { | ||
return this.getByType(main_1.Channel); | ||
} | ||
getComments() { | ||
return this.getByType(main_1.Comment); | ||
} | ||
getCommentThreads() { | ||
return this.getByType(main_1.CommentThread); | ||
} | ||
} | ||
exports.ContinuatedList = ContinuatedList; | ||
_ContinuatedList_requestOptions = new WeakMap(), _ContinuatedList_httpclient = new WeakMap(), _ContinuatedList_dataprocessor = new WeakMap(), _ContinuatedList_continuationToken = new WeakMap(); | ||
_ContinuatedList_requestOptions = new WeakMap(), _ContinuatedList_httpclient = new WeakMap(), _ContinuatedList_dataprocessor = new WeakMap(); |
@@ -5,6 +5,7 @@ import { Channel } from "../interfaces/Channel"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { Comment, CommentThread } from "../main"; | ||
declare function recursiveSearchForPair(searchKey: string, obj: any): any[]; | ||
declare function recursiveSearchForKey(searchKey: string, obj: any): any[]; | ||
declare function getNumberFromText(str: string): number; | ||
declare function processRendererItems(arr: Array<any>, httpclient: WrappedHTTPClient): (Video | Channel | Playlist | undefined)[]; | ||
declare function processRendererItems(arr: Array<any>, httpclient: WrappedHTTPClient): (Video | Channel | Playlist | Comment | CommentThread | undefined)[]; | ||
declare const _default: { | ||
@@ -11,0 +12,0 @@ recursiveSearchForPair: typeof recursiveSearchForPair; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
const main_1 = require("../main"); | ||
function recursiveSearchForPair(searchKey, obj) { | ||
@@ -83,2 +84,12 @@ if (typeof obj != 'object') | ||
} | ||
else if (elem.commentThreadRenderer) { | ||
var commentThread = new main_1.CommentThread(httpclient); | ||
commentThread.fromCommentThreadRenderer(elem.commentThreadRenderer); | ||
return commentThread; | ||
} | ||
else if (elem.commentRenderer) { | ||
var comment = new main_1.Comment(httpclient); | ||
comment.fromCommentRenderer(elem.commentRenderer); | ||
return comment; | ||
} | ||
else if (elem.playlistRenderer) { | ||
@@ -85,0 +96,0 @@ var playlist = new Playlist_1.Playlist(httpclient); |
@@ -1,2 +0,2 @@ | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { WrappedHTTPClient } from "../main"; | ||
import { ContinuatedList } from "./ContinuatedList"; | ||
@@ -3,0 +3,0 @@ export declare class PlaylistContinuatedList extends ContinuatedList { |
@@ -15,4 +15,4 @@ "use strict"; | ||
const helpers_1 = require("./helpers"); | ||
const constants_1 = require("../constants"); | ||
const ContinuatedList_1 = require("./ContinuatedList"); | ||
const constants_1 = require("../constants"); | ||
class PlaylistContinuatedList extends ContinuatedList_1.ContinuatedList { | ||
@@ -19,0 +19,0 @@ constructor(playlistId, httpclient) { |
@@ -1,6 +0,3 @@ | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { ChannelBadge } from "./ChannelBadge"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { ContinuatedList, Thumbnail, ChannelBadge, WrappedHTTPClient } from "../main"; | ||
import { ChannelLink } from "./ChannelLink"; | ||
import { ContinuatedList } from "../main"; | ||
export declare class Channel { | ||
@@ -34,2 +31,3 @@ #private; | ||
fromGridChannelRenderer(obj: any): void; | ||
fromCommentRenderer(obj: any): void; | ||
loadAll(): Promise<void>; | ||
@@ -36,0 +34,0 @@ loadDetailsFromAboutPage(): Promise<void>; |
@@ -20,5 +20,5 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
const main_1 = require("../main"); | ||
const helpers_1 = require("../fetchers/helpers"); | ||
const HTTPClient_1 = require("./HTTPClient"); | ||
const main_1 = require("../main"); | ||
class Channel { | ||
@@ -116,2 +116,13 @@ constructor(httpclient) { | ||
} | ||
fromCommentRenderer(obj) { | ||
const navigationEndpoint = helpers_1.default.recursiveSearchForKey("authorEndpoint", obj)[0]; | ||
if (navigationEndpoint) | ||
this.channelId = helpers_1.default.recursiveSearchForKey("browseId", navigationEndpoint)[0]; | ||
const titleContainer = helpers_1.default.recursiveSearchForKey("authorText", obj)[0]; | ||
if (titleContainer) | ||
this.title = helpers_1.default.recursiveSearchForKey("simpleText", titleContainer).join(""); | ||
const authorThumbnailContainer = helpers_1.default.recursiveSearchForKey("authorThumbnail", obj)[0]; | ||
if (authorThumbnailContainer) | ||
this.thumbnails = helpers_1.default.recursiveSearchForKey("thumbnails", authorThumbnailContainer)[0]; | ||
} | ||
loadAll() { | ||
@@ -118,0 +129,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -1,2 +0,2 @@ | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { Thumbnail } from "../main"; | ||
export interface ChannelLink { | ||
@@ -3,0 +3,0 @@ url: string; |
import { PlaylistContinuatedList } from "../fetchers/PlaylistContinuatedList"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { Channel } from "./Channel"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { Video } from "./Video"; | ||
import { Video, Thumbnail, Channel, WrappedHTTPClient } from "../main"; | ||
export declare class Playlist { | ||
@@ -7,0 +4,0 @@ #private; |
@@ -27,4 +27,4 @@ "use strict"; | ||
const PlaylistContinuatedList_1 = require("../fetchers/PlaylistContinuatedList"); | ||
const Channel_1 = require("./Channel"); | ||
const HTTPClient_1 = require("./HTTPClient"); | ||
const main_1 = require("../main"); | ||
const constants_1 = require("../constants"); | ||
@@ -48,3 +48,3 @@ class Playlist { | ||
if (channelContainer) { | ||
this.owner = new Channel_1.Channel(this.httpclient); | ||
this.owner = new main_1.Channel(this.httpclient); | ||
this.owner.fromPlaylistRenderer(obj); | ||
@@ -110,3 +110,3 @@ } | ||
if (videoOwnerContainer) { | ||
this.owner = new Channel_1.Channel(this.httpclient); | ||
this.owner = new main_1.Channel(this.httpclient); | ||
this.owner.fromVideoOwnerRenderer(videoOwnerContainer); | ||
@@ -113,0 +113,0 @@ } |
@@ -1,4 +0,2 @@ | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { Channel } from "./Channel"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { ContinuatedList, WrappedHTTPClient, Channel, Thumbnail } from "../main"; | ||
export declare class Video { | ||
@@ -20,2 +18,3 @@ videoId?: any; | ||
fromPlaylistVideoRenderer(obj: any): void; | ||
getCommentThreadList(): Promise<ContinuatedList>; | ||
like(): Promise<boolean>; | ||
@@ -22,0 +21,0 @@ dislike(): Promise<boolean>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const helpers_1 = require("../fetchers/helpers"); | ||
const Channel_1 = require("./Channel"); | ||
const main_1 = require("../main"); | ||
const HTTPClient_1 = require("./HTTPClient"); | ||
@@ -50,3 +50,3 @@ class Video { | ||
if (helpers_1.default.recursiveSearchForKey("ownerText", obj).length > 0) { | ||
this.owner = new Channel_1.Channel(this.httpclient); | ||
this.owner = new main_1.Channel(this.httpclient); | ||
this.owner.fromVideoRenderer(obj); | ||
@@ -59,3 +59,3 @@ } | ||
if (shortBylineText) { | ||
this.owner = new Channel_1.Channel(this.httpclient); | ||
this.owner = new main_1.Channel(this.httpclient); | ||
this.owner.fromGridVideoRenderer(obj); | ||
@@ -68,3 +68,3 @@ } | ||
if (shortBylineText) { | ||
this.owner = new Channel_1.Channel(this.httpclient); | ||
this.owner = new main_1.Channel(this.httpclient); | ||
this.owner.fromPlaylistVideoRendererBylineText(shortBylineText); | ||
@@ -74,2 +74,9 @@ } | ||
} | ||
getCommentThreadList() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var list = new main_1.CommentSectionContinuatedList(this.videoId, this.httpclient); | ||
yield list.loadFurhter(); | ||
return list; | ||
}); | ||
} | ||
like() { | ||
@@ -76,0 +83,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -14,2 +14,7 @@ import { NodeFetchClientAdapter } from "./adapters/NodeFetchClientAdapter"; | ||
import { StorageAdapter } from "./interfaces/StorageAdapter"; | ||
import { CommentSectionContinuatedList } from "./fetchers/CommentSectionContinuatedList"; | ||
import { Comment } from "./interfaces/Comment"; | ||
import { CommentThread } from "./interfaces/CommentThread"; | ||
import { WrappedHTTPClient } from "./WrappedHTTPClient"; | ||
import { CommentThreadRepliesContinuatedList } from "./fetchers/CommentThreadRepliesContinuatedList"; | ||
import { default as IYoutube } from "./Iyoutube"; | ||
@@ -21,2 +26,3 @@ export { IYoutube as IYoutube }; | ||
export { StorageAdapter as StorageAdapter }; | ||
export { WrappedHTTPClient as WrappedHTTPClient }; | ||
export { Explorer as Explorer }; | ||
@@ -31,2 +37,6 @@ export { User as User }; | ||
export { ChannelBadge as ChannelBadge }; | ||
export { CommentSectionContinuatedList as CommentSectionContinuatedList }; | ||
export { Comment as Comment }; | ||
export { CommentThread as CommentThread }; | ||
export { CommentThreadRepliesContinuatedList as CommentThreadRepliesContinuatedList }; | ||
export declare const nodeInst: IYoutube; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nodeInst = exports.Playlist = exports.Video = exports.Channel = exports.Authenticator = exports.ContinuatedList = exports.User = exports.Explorer = exports.NodeFetchClientAdapter = exports.NodeFSStorageAdapater = exports.IYoutube = void 0; | ||
exports.nodeInst = exports.CommentThreadRepliesContinuatedList = exports.CommentThread = exports.Comment = exports.CommentSectionContinuatedList = exports.Playlist = exports.Video = exports.Channel = exports.Authenticator = exports.ContinuatedList = exports.User = exports.Explorer = exports.WrappedHTTPClient = exports.NodeFetchClientAdapter = exports.NodeFSStorageAdapater = exports.IYoutube = void 0; | ||
const NodeFetchClientAdapter_1 = require("./adapters/NodeFetchClientAdapter"); | ||
@@ -22,2 +22,12 @@ Object.defineProperty(exports, "NodeFetchClientAdapter", { enumerable: true, get: function () { return NodeFetchClientAdapter_1.NodeFetchClientAdapter; } }); | ||
Object.defineProperty(exports, "Playlist", { enumerable: true, get: function () { return Playlist_1.Playlist; } }); | ||
const CommentSectionContinuatedList_1 = require("./fetchers/CommentSectionContinuatedList"); | ||
Object.defineProperty(exports, "CommentSectionContinuatedList", { enumerable: true, get: function () { return CommentSectionContinuatedList_1.CommentSectionContinuatedList; } }); | ||
const Comment_1 = require("./interfaces/Comment"); | ||
Object.defineProperty(exports, "Comment", { enumerable: true, get: function () { return Comment_1.Comment; } }); | ||
const CommentThread_1 = require("./interfaces/CommentThread"); | ||
Object.defineProperty(exports, "CommentThread", { enumerable: true, get: function () { return CommentThread_1.CommentThread; } }); | ||
const WrappedHTTPClient_1 = require("./WrappedHTTPClient"); | ||
Object.defineProperty(exports, "WrappedHTTPClient", { enumerable: true, get: function () { return WrappedHTTPClient_1.WrappedHTTPClient; } }); | ||
const CommentThreadRepliesContinuatedList_1 = require("./fetchers/CommentThreadRepliesContinuatedList"); | ||
Object.defineProperty(exports, "CommentThreadRepliesContinuatedList", { enumerable: true, get: function () { return CommentThreadRepliesContinuatedList_1.CommentThreadRepliesContinuatedList; } }); | ||
const Iyoutube_1 = require("./Iyoutube"); | ||
@@ -24,0 +34,0 @@ Object.defineProperty(exports, "IYoutube", { enumerable: true, get: function () { return Iyoutube_1.default; } }); |
{ | ||
"name": "iyoutube", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "The ultimate unofficial YouTube API Client for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "output/main.js", |
@@ -63,2 +63,4 @@ export const DEBUG = false; | ||
export const ENDPOINT_UNSUBSCRIBE = "https://www.youtube.com/youtubei/v1/subscription/unsubscribe"; | ||
export const ENDPOINT_ADDTOPLAYLIST = "https://www.youtube.com/youtubei/v1/playlist/get_add_to_playlist"; | ||
export const ENDPOINT_ADDTOPLAYLIST = "https://www.youtube.com/youtubei/v1/playlist/get_add_to_playlist"; | ||
export const ENDPOINT_NEXT = "https://www.youtube.com/youtubei/v1/next"; | ||
export const ENDPOINT_COMMENT_ACTION = "https://www.youtube.com/youtubei/v1/comment/perform_comment_action"; |
@@ -1,11 +0,9 @@ | ||
import { Channel } from "diagnostics_channel"; | ||
import helpers from "./helpers"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { HTTPRequestMethod, HTTPRequestOptions } from "../interfaces/HTTPClient"; | ||
import { Playlist } from "../interfaces/Playlist"; | ||
import { Video } from "../interfaces/Video"; | ||
import { HTTPRequestOptions } from "../interfaces/HTTPClient"; | ||
import { Video, Channel, Playlist, Comment, CommentThread } from "../main"; | ||
export class ContinuatedList { | ||
results: Array<Video | Channel | Playlist>; | ||
results: Array<Video | Channel | Playlist | Comment | CommentThread>; | ||
endReached = false; | ||
@@ -16,3 +14,3 @@ | ||
#dataprocessor: Function; | ||
#continuationToken = ""; | ||
continuationToken = ""; | ||
onlyContinuation = false; | ||
@@ -31,6 +29,7 @@ | ||
var joinedData = this.#requestOptions.data; | ||
if(this.#continuationToken != "") { | ||
joinedData.continuation = this.#continuationToken; | ||
if(this.onlyContinuation) { | ||
delete joinedData["browseId"]; | ||
if(!joinedData) joinedData = {}; | ||
if(this.continuationToken != "") { | ||
joinedData.continuation = this.continuationToken; | ||
if(this.onlyContinuation) joinedData = { | ||
continuation: this.continuationToken | ||
} | ||
@@ -49,3 +48,3 @@ } | ||
const continuationCommand = helpers.recursiveSearchForKey("continuationCommand", resJSON)[0]; | ||
if(continuationCommand) this.#continuationToken = continuationCommand.token; | ||
if(continuationCommand) this.continuationToken = continuationCommand.token; | ||
else this.endReached = true; | ||
@@ -59,6 +58,25 @@ | ||
getByType(type: typeof Video | typeof Playlist | typeof Channel) { | ||
const refactoredType:any = type; | ||
return this.results.filter((elem) => { return elem instanceof refactoredType }); | ||
getByType(type: any) { | ||
return this.results.filter((elem) => { return elem instanceof type }); | ||
} | ||
getVideos():Array<Video> { | ||
return this.getByType(Video) as Array<Video> | ||
} | ||
getPlaylists():Array<Playlist> { | ||
return this.getByType(Playlist) as Array<Playlist>; | ||
} | ||
getChannels():Array<Channel> { | ||
return this.getByType(Channel) as Array<Channel>; | ||
} | ||
getComments():Array<Comment> { | ||
return this.getByType(Comment) as Array<Comment>; | ||
} | ||
getCommentThreads():Array<CommentThread> { | ||
return this.getByType(CommentThread) as Array<CommentThread>; | ||
} | ||
} |
@@ -6,2 +6,3 @@ import { Channel } from "../interfaces/Channel"; | ||
import { CONSOLE_COLORS } from "../constants"; | ||
import { Comment, CommentThread } from "../main"; | ||
@@ -87,2 +88,13 @@ function recursiveSearchForPair(searchKey: string, obj: any) { | ||
} | ||
/* Comments */ | ||
else if(elem.commentThreadRenderer) { | ||
var commentThread = new CommentThread(httpclient); | ||
commentThread.fromCommentThreadRenderer(elem.commentThreadRenderer) | ||
return commentThread; | ||
} else if(elem.commentRenderer) { | ||
var comment = new Comment(httpclient); | ||
comment.fromCommentRenderer(elem.commentRenderer); | ||
return comment; | ||
} | ||
@@ -89,0 +101,0 @@ /* Playlist */ |
import { HTTPRequestMethod } from "../interfaces/HTTPClient"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import helpers from "./helpers"; | ||
import { ENDPOINT_BROWSE } from "../constants"; | ||
import { Video, WrappedHTTPClient } from "../main"; | ||
import { ContinuatedList } from "./ContinuatedList"; | ||
import { ENDPOINT_BROWSE } from "../constants"; | ||
@@ -7,0 +7,0 @@ export class PlaylistContinuatedList extends ContinuatedList { |
import { ENDPOINT_BROWSE, ENDPOINT_SUBSCRIBE, ENDPOINT_UNSUBSCRIBE } from "../constants"; | ||
import { ContinuatedList, Thumbnail, ChannelBadge, WrappedHTTPClient } from "../main"; | ||
import helpers from "../fetchers/helpers" | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { ChannelBadge } from "./ChannelBadge"; | ||
import { HTTPRequestMethod } from "./HTTPClient"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { ChannelLink } from "./ChannelLink"; | ||
import { ContinuatedList } from "../main"; | ||
export class Channel { | ||
@@ -146,2 +144,16 @@ channelId?: string; | ||
fromCommentRenderer(obj: any) { | ||
const navigationEndpoint = helpers.recursiveSearchForKey("authorEndpoint", obj)[0]; | ||
if(navigationEndpoint) | ||
this.channelId = helpers.recursiveSearchForKey("browseId", navigationEndpoint)[0]; | ||
const titleContainer = helpers.recursiveSearchForKey("authorText", obj)[0]; | ||
if(titleContainer) | ||
this.title = helpers.recursiveSearchForKey("simpleText", titleContainer).join(""); | ||
const authorThumbnailContainer = helpers.recursiveSearchForKey("authorThumbnail", obj)[0]; | ||
if(authorThumbnailContainer) | ||
this.thumbnails = helpers.recursiveSearchForKey("thumbnails", authorThumbnailContainer)[0]; | ||
} | ||
async loadAll() { | ||
@@ -148,0 +160,0 @@ await this.loadDetailsFromAboutPage(); |
@@ -1,2 +0,2 @@ | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { Thumbnail } from "../main"; | ||
@@ -3,0 +3,0 @@ export interface ChannelLink { |
import helpers from "../fetchers/helpers"; | ||
import { PlaylistContinuatedList } from "../fetchers/PlaylistContinuatedList"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { Channel } from "./Channel"; | ||
import { ContinuatedList } from "../fetchers/ContinuatedList"; | ||
import { HTTPRequestMethod } from "./HTTPClient"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
import { Video } from "./Video"; | ||
import { Video, Thumbnail, ContinuatedList, Channel, WrappedHTTPClient } from "../main"; | ||
import { ENDPOINT_BROWSE, ENDPOINT_LIKE, ENDPOINT_REMOVELIKE } from "../constants"; | ||
@@ -10,0 +6,0 @@ |
import { ENDPOINT_DISLIKE, ENDPOINT_LIKE, ENDPOINT_REMOVELIKE } from "../constants"; | ||
import helpers from "../fetchers/helpers"; | ||
import { WrappedHTTPClient } from "../WrappedHTTPClient"; | ||
import { Channel } from "./Channel"; | ||
import { CommentSectionContinuatedList, ContinuatedList, WrappedHTTPClient, Channel, Thumbnail } from "../main"; | ||
import { HTTPRequestMethod } from "./HTTPClient"; | ||
import { Thumbnail } from "./Thumbnail"; | ||
@@ -97,2 +95,8 @@ export class Video { | ||
async getCommentThreadList():Promise<ContinuatedList> { | ||
var list = new CommentSectionContinuatedList(this.videoId, this.httpclient); | ||
await list.loadFurhter(); | ||
return list; | ||
} | ||
async like() { | ||
@@ -99,0 +103,0 @@ const res = await this.httpclient.request({ |
@@ -14,2 +14,7 @@ import { NodeFetchClientAdapter } from "./adapters/NodeFetchClientAdapter"; | ||
import { StorageAdapter } from "./interfaces/StorageAdapter"; | ||
import { CommentSectionContinuatedList } from "./fetchers/CommentSectionContinuatedList"; | ||
import { Comment } from "./interfaces/Comment"; | ||
import { CommentThread } from "./interfaces/CommentThread"; | ||
import { WrappedHTTPClient } from "./WrappedHTTPClient"; | ||
import { CommentThreadRepliesContinuatedList } from "./fetchers/CommentThreadRepliesContinuatedList"; | ||
import { default as IYoutube } from "./Iyoutube"; | ||
@@ -22,3 +27,4 @@ | ||
export { HTTPClient as HTTPClient } | ||
export { StorageAdapter as StorageAdapter }; | ||
export { StorageAdapter as StorageAdapter } | ||
export { WrappedHTTPClient as WrappedHTTPClient } | ||
@@ -35,2 +41,6 @@ export { Explorer as Explorer } | ||
export { ChannelBadge as ChannelBadge } | ||
export { CommentSectionContinuatedList as CommentSectionContinuatedList } | ||
export { Comment as Comment } | ||
export { CommentThread as CommentThread } | ||
export { CommentThreadRepliesContinuatedList as CommentThreadRepliesContinuatedList } | ||
@@ -37,0 +47,0 @@ //Default Export for most NodeJS |
@@ -32,9 +32,12 @@ //Import the nodeInst Export of IYoutube | ||
await testPlaylistVideos.loadFurhter(); //Load Batch of Videos into List | ||
console.log(testPlaylistVideos.results.length); | ||
console.log(testPlaylistVideos.getVideos().length); | ||
await testPlaylistVideos.loadFurhter(); //Load next Batch of Videos into List | ||
console.log(testPlaylistVideos.results.length); | ||
console.log(testPlaylistVideos.getVideos().length); | ||
console.log(testPlaylistVideos.endReached); | ||
//Dirty way of getting the Results (without any Type), use the Getters instead! | ||
console.log(testPlaylistVideos.results); | ||
// 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 | ||
})(); |
@@ -5,3 +5,3 @@ ## Todo | ||
- [ ] Fetch all Information | ||
- [ ] Get Channel Playlists (custom and Uploads) | ||
- [X] Get Channel Uploads | ||
- [ ] Get Discussion Section | ||
@@ -12,3 +12,4 @@ | ||
- [ ] Stream URL Decryption | ||
- [ ] Get Comment Section | ||
- [X] Get Comment Section | ||
- [X] Like and Dislike Comments | ||
- [ ] Write Comments | ||
@@ -23,2 +24,2 @@ | ||
######Please keep in mind that I'm working on this Project in my spare time! | ||
###### Please keep in mind that I'm working on this Project in my spare time! |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192503
85
3792