Giter Site home page Giter Site logo

kylof61034 / yt-channel-info Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freetubeapp/yt-channel-info

0.0 0.0 0.0 426 KB

A Node.js module for grabbing channel information without any official API

License: ISC License

JavaScript 100.00%

yt-channel-info's Introduction

YouTube Channel Info NodeJS Documentation

This library is designed to receive channel data from YouTube without accessing the official API.
This method has several advantages:

  • No API key is required, which you should put next to your code;
  • No restrictions on key usage (1 million quota)

But there are also disadvantages:

  • Data acquisition time increases by many times;
  • Any change to the YouTube DOM entails non-working methods of this library.

You must consider this before you use YouTube Channel Info

Installation

npm i yt-channel-info --save

Usage

// If using require
const ytch = require('yt-channel-info')

// If using import
import ytch from 'yt-channel-info'

API

getChannelInfo(channelId)

Returns information about a given channel ID.

const channelId = 'UCXuqSBlHAE6Xw-yeJA0Tunw'

ytch.getChannelInfo(channelId).then((response) => {
   console.log(response)
}).catch((err) => {
   console.log(err)
})


// Response object
{
   author: String,
   authorId: String,
   authorUrl: String,
   authorBanners: Array[Object], // Will return null if none exist
   authorThumbnails: Array[Object], // Will return null if none exist
   subscriberText: String,
   subscriberCount: Integer,
   description: String,
   isFamilyFriendly: Boolean,
   relatedChannels: Array[Object],
   allowedRegions: Array[String],
   isVerified: Boolean,
}

getChannelVideos(channelId, [sortBy])

Grabs videos from a given channel ID.

  • newest - Grabs videos from a channel sorted by newest / most recently uploaded (Default option if none given)
  • oldest - Grabs videos from a channel sorted by oldest videos
  • popular - Grabs videos from a channel sorted by the most popular (Highest amount of views)
const channelId = 'UCXuqSBlHAE6Xw-yeJA0Tunw'
const sortBy = 'newest'

ytch.getChannelVideos(channelId, sortBy).then((response) => {
  console.log(response)
}).catch((err) => {
  console.log(err)
})

// Response object
{
  items: Array[Object],
  continuation: String // Will return null if no more results can be found.  Used with getChannelVideosMore()
}

getChannelVideosMore(continuation)

Grabs more videos within a channel. Uses the continuation string returned from getChannelVideos() or from past calls to getChannelVideosMore().

const continuation = '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D'

ytch.getChannelInfoMore(continuation).then((response) => {
 console.log(response)
}).catch((err) => {
 console.log(err)
})

// Response object 
{
 items: Array[Object],
 continuation: String // Will return null if no more results can be found.  Used with getChannelVideosMore()
}

getChannelPlaylistInfo(channelId, [sortBy])

Grabs playlist information of a given channel ID.

  • last - Grabs playlists from a channel sorted by the most recently updated playlist (Default option if none given)
  • oldest - Grabs playlists from a channel sorted by the creation date (oldest first)
  • newest - Grabs playlists from a channel sorted by the creation date (newest first)
const channelId = 'UCXuqSBlHAE6Xw-yeJA0Tunw'
const sortBy = 'last'

ytch.getChannelPlaylistInfo(channelId, sortBy).then((response) => {
 console.log(response)
}).catch((err) => {
 console.log(err)
})

// Response object
{
 items: Array[Object],
 continuation: String // Will return null if no more results can be found.  Used with getChannelPlaylistsMore()
}

getChannelPlaylistsMore(continuation)

Grabs more playlists within a channel. Uses the continuation string returned from getChannelPlaylists() or from past calls to getChannelPlaylistsMore().

const continuation = '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D'

ytch.getChannelPlaylistsMore(continuation).then((response) => {
 console.log(response)
}).catch((err) => {
 console.log(err)
})

// Response object
{
 items: Array[Object],
 continuation: String // Will return null if no more results can be found.  Used with getChannelPlaylistsMore()
}

searchChannel(channelId, query)

Searchs for videos and playlists of a given channelId based on the given query

const channelId = 'UCXuqSBlHAE6Xw-yeJA0Tunw'
const query = 'linux'

ytch.searchChannel(channelId, query).then((response) => {
console.log(response)
}).catch((err) => {
console.log(err)
})

// Response object
{
items: Array[Object],
continuation: String // Will return null if no more results can be found.  Used with searchChannelMore()
}

searchChannelMore(continuation)

Grabs more search results within a channel. Uses the continuation string returned from searchChannel() or from past calls to searchChannelMore().

const continuation = '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D'

ytch.searchChannelMore(continuation).then((response) => {
 console.log(response)
}).catch((err) => {
 console.log(err)
})

// Response object
{
 items: Array[Object],
 continuation: String // Will return null if no more results can be found.  Used with searchChannelMore()
}

Tests

Tests and code standards are still in the process of being created. Check back later for information on how tests should be performed.

Contribution

PRs are welcome. Testing and coding guidlines are still in the works so I will try to get those created at a later point. Try to keep similar code syntax to the rest of the code.

Credits

This is a fork of the youtube-grabber-js module created by OlegRom4ig

View the original project on NPM or GitLab

License

You have explicit permission to use this project as stated in the terms of the ISC license.

yt-channel-info's People

Contributors

prestonn avatar dependabot[bot] avatar chrrs avatar patrickkfkan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.