mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
chore: remove a few deprecated methods
This commit is contained in:
@@ -132,28 +132,6 @@ class Innertube {
|
||||
response.success && (this.logged_in = false);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves search suggestions for a given query.
|
||||
*
|
||||
* @param {string} query - the search query.
|
||||
* @param {object} [options] - search options.
|
||||
* @param {string} [options.client='YOUTUBE'] - client used to retrieve search suggestions, can be: `YOUTUBE` or `YTMUSIC`.
|
||||
* @returns {Promise.<{ query: string, results: string[] }>}
|
||||
*/
|
||||
async getSearchSuggestions(query, options = { client: 'YOUTUBE' }) {
|
||||
Utils.throwIfMissing({ query });
|
||||
|
||||
const response = await this.actions.getSearchSuggestions(options.client, query);
|
||||
if (options.client === 'YTMUSIC' && !response.data.contents) return [];
|
||||
|
||||
const suggestions = new Parser(this, response.data, {
|
||||
client: options.client,
|
||||
data_type: 'SEARCH_SUGGESTIONS'
|
||||
}).parse();
|
||||
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves video info.
|
||||
@@ -204,7 +182,29 @@ class Innertube {
|
||||
const response = await this.actions.search({ query, filters });
|
||||
return new Search(this.actions, response.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves search suggestions for a given query.
|
||||
*
|
||||
* @param {string} query - the search query.
|
||||
* @param {object} [options] - search options.
|
||||
* @param {string} [options.client='YOUTUBE'] - client used to retrieve search suggestions, can be: `YOUTUBE` or `YTMUSIC`.
|
||||
* @returns {Promise.<{ query: string, results: string[] }>}
|
||||
*/
|
||||
async getSearchSuggestions(query, options = { client: 'YOUTUBE' }) {
|
||||
Utils.throwIfMissing({ query });
|
||||
|
||||
const response = await this.actions.getSearchSuggestions(options.client, query);
|
||||
if (options.client === 'YTMUSIC' && !response.data.contents) return [];
|
||||
|
||||
const suggestions = new Parser(this, response.data, {
|
||||
client: options.client,
|
||||
data_type: 'SEARCH_SUGGESTIONS'
|
||||
}).parse();
|
||||
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves video info.
|
||||
*
|
||||
@@ -282,7 +282,7 @@ class Innertube {
|
||||
|
||||
/**
|
||||
* Retrieves watch history.
|
||||
*
|
||||
*
|
||||
* @returns {Promise.<{ items: Array.<{ date: string, videos: object[] }>}>}
|
||||
*/
|
||||
async getHistory() {
|
||||
@@ -319,21 +319,6 @@ class Innertube {
|
||||
|
||||
return new TabbedFeed(this.actions, response.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo finish this
|
||||
* WIP
|
||||
*/
|
||||
async getLibrary() {
|
||||
const response = await this.actions.browse('FElibrary');
|
||||
|
||||
const library = new Parser(this, response.data, {
|
||||
client: 'YOUTUBE',
|
||||
data_type: 'LIBRARY'
|
||||
}).parse();
|
||||
|
||||
return library;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves subscriptions feed.
|
||||
@@ -377,25 +362,6 @@ class Innertube {
|
||||
return response.data.unseenCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves lyrics for a given song if available.
|
||||
*
|
||||
* @param {string} video_id
|
||||
* @returns {Promise.<string>}
|
||||
*/
|
||||
async getLyrics(video_id) {
|
||||
Utils.throwIfMissing({ video_id });
|
||||
|
||||
const continuation = await this.actions.next({ video_id: video_id, client: 'YTMUSIC' });
|
||||
const lyrics_tab = Utils.findNode(continuation, 'contents', 'Lyrics', 8, false);
|
||||
|
||||
const response = await this.actions.browse(lyrics_tab.endpoint?.browseEndpoint.browseId, { client: 'YTMUSIC' });
|
||||
if (!response.data?.contents?.sectionListRenderer) throw new Utils.UnavailableContentError('Lyrics not available', { video_id });
|
||||
|
||||
const lyrics = Utils.findNode(response.data, 'contents', 'runs', 6, false);
|
||||
return lyrics.runs[0].text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the contents of a given playlist.
|
||||
*
|
||||
@@ -428,7 +394,6 @@ class Innertube {
|
||||
*/
|
||||
async getStreamingData(video_id, options = {}) {
|
||||
const info = await this.getBasicInfo(video_id);
|
||||
|
||||
return info.chooseFormat(options);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user