0.2.0 • Published 4 years ago
youtube-scraper-improved v0.2.0
Youtube Scraper Improved
Description
Promise based youtube scraper. Working towards typescript implementation.
Current functionality
- Get a transcript from a video
- Get a channel id from a username based url
- Get number of public uploaded videos from a channel
- Get all public uploaded video ids from a channel
Installation
npm install youtube-scraper-improved
Usage
const ytsi = require('youtube-scraper-improved');
(async function() {
try {
const scraper = new ytsi();
const transcript = await scraper.Transcript.getTranscript('a_TSR_v07m0');
console.log('transcript', transcript);
} catch (error) {
console.log('error');
console.log(error);
};
})();
Functions
# Get transcript from youtube
# Argument: Id of video
# Returns: string in srv format by default
scraperInstance.Transcript.getTranscript('video-id-goes-here');
# Example URLS
# Channel id: https://www.youtube.com/channel/UCd_3THjYRVujgverdszeGfQ
# Username channel: https://www.youtube.com/user/polynesiancultural
# Get channel id from user name channel url
# Argument: Username channel url string
# Returns: UCd_3THjYRVujgverdszeGfQ
scraperInstance.Channel.getChannelIdByUserChannelUrl('user-channel-url-goes-here');
# Get number of uploaded videos
# Argument: Channel id or username url + '/videos'
# Ex Arg: https://www.youtube.com/user/polynesiancultural/videos
# Returns: Number of videos
scraperInstance.Channel.getNumberOfUploadedVideos('url-goes-here');
# Get all updated video ids
# Argument: Channel id or username url
# Returns: Array of strings
scraperInstance.Channel.getAllUploadedVideoIds('url-goes-here');
TODO
- Add more data endpoints
- Add Youtube API wrapper functionality
- Add testing -- Test if transcript does not exist, etc...