{"_id":"@apteryxxyz/yt-channel-info","name":"@apteryxxyz/yt-channel-info","dist-tags":{"latest":"3.2.1"},"versions":{"3.2.1":{"name":"@apteryxxyz/yt-channel-info","version":"3.2.1","description":"Grab YouTube channel information without any official API","main":"index.js","scripts":{"test":"jest --watchAll --verbose --coverage","test-ci":"jest --verbose --ci  --coverage","lint-fix":"eslint --fix --ext .js ./","lint":"eslint --ext .js ./"},"keywords":["youtube","youtube-fetch","youtube-scrapper","youtube-grabber","youtube channel","youtube-channel","youtube playlist","youtube-playlist","youtube without api","youtube-fetcher"],"author":{"name":"PrestonFT"},"license":"ISC","dependencies":{"axios":"^1.1.2"},"repository":{"type":"git","url":"git+https://github.com/FreeTubeApp/yt-channel-info.git"},"devDependencies":{"eslint":"^8.22.0","eslint-config-prettier":"^8.5.0","eslint-config-standard":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-n":"15.6.1","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-promise":"^6.0.0","jest":"^29.1.2","prettier":"^2.7.1"},"types":"index.d.ts","gitHead":"e37e37ed58de6d82bb4ccdd631bd8efad4b59254","bugs":{"url":"https://github.com/FreeTubeApp/yt-channel-info/issues"},"homepage":"https://github.com/FreeTubeApp/yt-channel-info#readme","_id":"@apteryxxyz/yt-channel-info@3.2.1","_nodeVersion":"18.12.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-+FA9opkCLtO+cH5Or0Lloy8NWcF6qKJcYLLNlHqD2lKh5b0K1T3vhIE5JO4j/n8i8t7SmZx1sTZcXG4PqZLXVw==","shasum":"df55ca4a534a355447429e6d01035540cfbad404","tarball":"https://registry.npmjs.org/@apteryxxyz/yt-channel-info/-/yt-channel-info-3.2.1.tgz","fileCount":9,"unpackedSize":89054,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBoI4C1eCM+vlPYLuKzngGfIoZNfhxPdI9gdsre8dgsHAiB34j9hdL3bs9EX9MZx2vLRq4t3/K/Uv+s7Xt0UakPssg=="}]},"_npmUser":{"name":"apteryxxyz","email":"apteryx.xyz@gmail.com"},"directories":{},"maintainers":[{"name":"apteryxxyz","email":"apteryx.xyz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yt-channel-info_3.2.1_1687710414492_0.02077048152569927"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-25T16:26:54.410Z","3.2.1":"2023-06-25T16:26:54.674Z","modified":"2023-06-25T16:26:54.993Z"},"maintainers":[{"name":"apteryxxyz","email":"apteryx.xyz@gmail.com"}],"description":"Grab YouTube channel information without any official API","homepage":"https://github.com/FreeTubeApp/yt-channel-info#readme","keywords":["youtube","youtube-fetch","youtube-scrapper","youtube-grabber","youtube channel","youtube-channel","youtube playlist","youtube-playlist","youtube without api","youtube-fetcher"],"repository":{"type":"git","url":"git+https://github.com/FreeTubeApp/yt-channel-info.git"},"author":{"name":"PrestonFT"},"bugs":{"url":"https://github.com/FreeTubeApp/yt-channel-info/issues"},"license":"ISC","readme":"This is a modified version of [yt-channel-info](https://github.com/FreeTubeApp/yt-channel-info) intended for myself.\n\n# YouTube Channel Info NodeJS Documentation\nThis library is designed to receive channel data from YouTube without accessing the official API.\n<br />\nThis method has several advantages:\n* No API key is required, which you should put next to your code;\n* No restrictions on key usage (1 million [quota](https://developers.google.com/youtube/v3/getting-started#quota))\n\nBut there are also disadvantages:\n* Data acquisition time increases by many times;\n* Any change to the YouTube DOM entails non-working methods of this library.\n\nYou must consider this before you use **YouTube Channel Info**\n\n## Installation\n```\nnpm i yt-channel-info --save\n```\n\n## Usage\n\n```javascript\n// If using require\nconst ytch = require('yt-channel-info')\n\n// If using import\nimport ytch from 'yt-channel-info'\n```\n\n## API\n\n**getChannelInfo(payload)**\n- payload (Object) (Required) - An object containing the various options\n  - channelId (String) (Required) - The channel ID to get info from\n  - channelIdType (Integer) (Optional) - Grabs newest comments when `true`. Grabs top comments when `false`\n    - `0` = Default value used by the module. It will try all url types in the order channel -> user -> name\n    - `1` = A channel id that is used with `https://www.youtube.com/channel/channelId` urls\n    - `2` = A user id that is used with `https://www.youtube.com/user/channelId` urls\n    - `3` = A name id that is used with `https://www.youtube.com/c/channelId` urls\n  - httpsAgent (Object) (Optional) -  Defines Proxy data in an object like https proxy agent. Allows to specify host, port, protocol, authentication (see section Proxy)\n\n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw', // Required\n   channelIdType: 0,\n   httpsAgent: agent\n}\n\nytch.getChannelInfo(payload).then((response) => {\n   if (!response.alertMessage) {\n      console.log(response)\n   } else {\n      console.log('Channel could not be found.')\n      // throw response.alertMessage\n   }\n}).catch((err) => {\n   console.log(err)\n})\n\n\n// Response object\n{\n   author: String,\n   authorId: String,\n   authorUrl: String,\n   authorBanners: Array[Object], // Will return null if none exist\n   authorThumbnails: Array[Object], // Will return null if none exist\n   subscriberText: String,\n   subscriberCount: Integer,\n   description: String,\n   isFamilyFriendly: Boolean,\n   relatedChannels: {\n      items: Array[Object],\n      continuation: String // Will return null if there are 12 or fewer related channels.  Used with getRelatedChannelsMore()\n   },\n   allowedRegions: Array[String],\n   isVerified: Boolean,\n   isOfficialArtist: Boolean,\n   tags: Array[String], // Will return null if none exist\n   channelIdType: Number, \n   channelTabs: Array[String], // The tabs that are displayed on the channel (e.g., Videos, Playlists)\n   alertMessage: String, // Will return a response alert message if any (e.g., \"This channel does not exist.\"). Otherwise undefined\n   channelLinks: {\n      primaryLinks: Array[Object],\n      secondaryLinks: Array[Object]\n   }\n}\n```\n\n**getChannelVideos(payload)**\n\nGrabs videos from a given channel ID.\n- payload (Object) (Required) - An object containing the various options\n  - channelId (String) (Required) - The channel ID to get videos from\n  - sortBy (String) (Optional) - How videos will be sorted\n    - `newest` - Grabs videos from a channel sorted by newest / most recently uploaded (Default option if none given)\n    - `oldest`- Grabs videos from a channel sorted by oldest videos\n    - `popular` - Grabs videos from a channel sorted by the most popular (Highest amount of views)\n  - channelIdType (Integer) (Optional) - Same definition as 'channelIdType' in `getChannelInfo()`\n  - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n\n ```javascript\n const payload = {\n    channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw', // Required\n    sortBy: 'newest',\n    channelIdType: 0\n }\n\nytch.getChannelVideos(payload).then((response) => {\n   if (!response.alertMessage) {\n      console.log(response)\n   } else {\n      console.log('Channel could not be found.')\n      // throw response.alertMessage\n   }\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String, // Will return null if no more results can be found.  Used with getChannelVideosMore()\n   channelIdType: Number,\n   alertMessage: String, // Will return a response alert message if any (e.g., \"This channel does not exist.\"). Otherwise undefined \n }\n ```\n\n **getChannelVideosMore(payload)**\n\n Grabs more videos within a channel.  Uses the continuation string returned from `getChannelVideos()` or from past calls to `getChannelVideosMore()`.\n\nGrabs videos from a given channel ID.\n- payload (Object) (Required) - An object containing the various options\n  - continuation (String) (Required) - The continuation string from `getChannelVideos()` or from past calls to `getChannelVideosMore()`.\n  - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in  `getChannelInfo()`\n\n\n ```javascript\n  const payload = {\n    continuation: '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D', // Required\n }\n\nytch.getChannelVideosMore(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with getChannelVideosMore()\n }\n ```\n\n **getChannelPlaylistInfo(payload)**\n\n Grabs playlist information of a given channel ID.\n - `payload (Object) (Required)` - An object containing the various options\n   - channelId (String) (Required) - The channel ID to grab playlists from\n   - sortBy (String) (Optional) - 'last' sort by last updated or 'newest' sort by creation date\n      - `last` - Grabs playlists from a channel sorted by the most recently updated playlist (Default option if none given)\n      - `oldest` - Grabs playlists from a channel sorted by the creation date (oldest first)\n      - `newest` - Grabs playlists from a channel sorted by the creation date (newest first)\n   - httpsAgent (Object) (Optional) - Same definition as 'httpsAgent' in `getChannelInfo()`\n   - channelIdType (Integer) (Optional) - Same definition as 'channelIdType' in `getChannelInfo()` \n\n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw',\n   sortBy: 'last',\n}\n\nytch.getChannelPlaylistInfo(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with getChannelPlaylistsMore()\n   channelIdType: Number,\n }\n ```\n\n  **getChannelPlaylistsMore(payload)**\n\n Grabs more playlists within a channel.  Uses the continuation string returned from `getChannelPlaylists()` or from past calls to `getChannelPlaylistsMore()`.\n - payload (Object) (Required) - An object containing the various options\n   - continuation (String) (Required) - The continuation string from `getChannelPlaylists()` or from past calls to `getChannelPlaylistsMore()`.\n   - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n\n```javascript\nconst payload = {\n   continuation: '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D'\n}\n\nytch.getChannelPlaylistsMore(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with getChannelPlaylistsMore()\n }\n ```\n\n **searchChannel(payload)**\n\n Searchs for videos and playlists of a given channelId based on the given query\n - payload (Object) (Required) - An object containing the various options\n   - channelId (String) (Required) - The channel you want to search\n   - query (String) (Required) - The query you want to use\n   - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n   - channelIdType (Integer) (Optional) - Same definition as 'channelIdType' `getChannelInfo()` \n  \n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw',\n   query: 'linux'\n}\n\nytch.searchChannel(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with searchChannelMore()\n }\n ```\n\n  **searchChannelMore(payload)**\n\n Grabs more search results within a channel.  Uses the continuation string returned from `searchChannel()` or from past calls to `searchChannelMore()`.\n - payload (Object) (Required) - An object containing the various options\n   - continuation (String) (Required) - The continuation string from `searchChannel()` or from past calls to `searchChannelMore()`.\n   - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n\n```javascript\nconst payload = {\n  continuation: '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D' \n}\n\nytch.searchChannelMore(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with searchChannelMore()\n }\n ```\n\n**getRelatedChannelsMore(payload)**\n\n Grabs more related channels within a channel.  Uses the relatedChannelsContinuation string returned from `getChannelInfo()` or from past calls to `getRelatedChannelsMore()`.\n - payload (Object) (Required) - An object containing the various options\n   - continuation (String) (Required) - The continuation string from `getChannelInfo()` or from past calls to `getRelatedChannelsMore()`.\n   - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n  \n```javascript\n const payload = {\n    continuation: '4qmFsgKlARIYVUNtOUs2cmJ5OThXOEppZ0xvWk9oNkZRGlhFZ2hqYUdGdWJtVnNjeGdESUFBd0FUZ0I2Z01vUTJkQlUwZG9iMWxXVlU1M1pXdHNVR1ZzUW5saE1IaGhXWHBhWm1SV1NsSldWazQyVG5wa1VnJTNEJTNEmgIuYnJvd3NlLWZlZWRVQ205SzZyYnk5OFc4SmlnTG9aT2g2RlFjaGFubmVsczE1Ng%3D%3D'\n } \n\nytch.getRelatedChannelsMore(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object],\n   continuation: String // Will return null if no more results can be found.  Used with getRelatedChannelsMore()\n }\n ```\n\n**getChannelCommunityPosts(payload)**\n\nSearches for all posts on the community page of a given channelId based on the given query.\n\n- payload (Object) (Required) - An object containing the various options\n  - channelId (String) (Required) - The channel ID to get community posts from\n  - channelIdType (Integer) (Optional) - Same definition as 'channelIdType' for `getChannelInfo()`\n  - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n\n\n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw'\n}\n\nytch.getChannelCommunityPosts(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object], // Described below\n   continuation: String, // Will return null if no more results can be found.  Used with searchChannelMore()\n   innerTubeApi: String,\n   channelIdType: Number,\n }\n ```\n\n **getChannelStats(payload)**\n\nGets the stats of a channel\n- payload (Object) (Required) - An object containing the various options\n  - channelId (String) (Required) - The channel ID to get stats from\n  - channelIdType (Integer) (Optional) - Same definition as `channelIdType` in `getChannelInfo()`\n  - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n\n\n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw'\n}\n\nytch.getChannelStats(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   joinedDate: Integer, // Date joined in ms\n   viewCount: Integer, // Total views on channel\n   location: String // location of channel\n }\n ```\n\n**getChannelCommunityPostsMore(payload)**\n\nGrabs more search results within a channel community page.  Uses the continuation and innerTubeApi strings returned from `getChannelCommunityPosts()` or from past calls to `getChannelCommunityPostsMore()`.\n- payload (Object) (Required) - An object containing the various options\n   - continuation (String) (Required) - The continuation string from `getChannelCommunityPosts()` or from past calls to `getChannelCommunityPostsMore()`.\n   - innterTubeApi (String) (Required) - The innerTubeApi string from `getChannelCommunityPosts()` or from past calls to `getChannelCommunityPostsMore()`.\n   - httpsAgent (Object) (Optional) -  Same definition as 'httpsAgent' in `getChannelInfo()`\n  \n```javascript\nconst payload = {\n   continuation: '4qmFsgK9ARIYVUNYdXFTQmxIQUU2WHcteWVKQTBUdW53GqABRWdsd2JHRjViR2x6ZEhNZ0FYcG1VVlZzVUdFeGF6VlNiVkoyV1ZjNWJHVnNUbGhTUmxwWVZrVm9kR1ZHYTNoVU1EVnJUVWR3ZFdNd05VVmFSVVo0Vm10NGRsVnJWa2haYkd4dVUyNXZlbEpxUW5WT1YxRjNXbGhyTkZKcVVqVmhibEpXVkVVNWNtSkdUbnBaYXpWWVUxZDNNMVpSdUFFQQ%3D%3D',\n   innerTubeApi: 'JNDJSGJHASJ44DSHGDNLGMHA6FSFas5faF5'\n}\n\nytch.getChannelCommunityPostsMore(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   items: Array[Object], // Described below\n   continuation: String, // Will return null if no more results can be found.  Used with searchChannelMore()\n   innerTubeApi: String\n }\n ```\n\n **getChannelHome(payload)**\n\n Searchs for videos and playlists of a given channelId based on the given query\n - payload (Object) (Required) - An object containing the various options\n   - channelId (String) (Required) - The channel you want to search\n   - channelIdType (Integer) (Optional) - defined as for `getChannelInfo()`\n   - httpsAgent (Object) (Optional) -  defined as for `getChannelInfo()`\n  \n```javascript\nconst payload = {\n   channelId: 'UCXuqSBlHAE6Xw-yeJA0Tunw',\n}\n\nytch.getChannelHome(payload).then((response) => {\n   console.log(response)\n}).catch((err) => {\n   console.log(err)\n})\n\n // Response object\n {\n   featuredVideo: {\n      type: 'video',\n      title: String,\n      videoId: String,\n      author: String,\n      authorId: String,\n      videoThumbnails: [],\n      viewCountText: String,\n      viewCount: Number,\n      publishedText: String,\n      durationText: undefined,\n      lengthSeconds: 0,\n      liveNow: Boolean,\n      premier: Boolean,\n      premium: Boolean\n   },\n   items: Array[Object],\n }\n ```\n**Community Posts Format**\n\nThe objects in the array of community posts all follow a basic structure but vary drastically in the postContent field of the object.\n\n-`httpsAgent` defined as for `getChannelInfo()`\n  \n```javascript\npostData = {\n  postText: String,\n  postId: String, \n  author: String,\n  authorThumbnails: Array[Object], // Array of objects with links to images\n  publishedText: String,\n  voteCount: String,\n  postContent: Object, // null if the post only consists of text\n  commentCount: String\n}\n\n// If the post contains an image\nimagePostContent = {\n  type: 'image',\n  content: Array[Object] // Array of objects with links to images\n}\n\npollPostContent = {\n   type: 'poll',\n   content: {\n      choices: Array[String],\n      totalVotes: String \n   }\n}\n\nvideoPostContent = {\n   type: 'video',\n   content: {\n      videoId: String,\n      title: String,\n      description: String,\n      publishedText: String,\n      lengthText: String,\n      viewCountText: String,\n      ownerBadges: Object, // Object indicating possible badges {verified: false, officialArtist: false}\n      author: String,\n      thumbnails: Array[Object] // Array of objects with links to images\n  }\n}\n\nplaylistPostContent = {\n   type: 'playlist',\n   content: {\n      playlistId: String,\n      title: String,\n      playlistVideoRenderer: Array[Object], // An array of minimized videoPostContent data\n      videoCountText: String,\n      ownerBadges: Array[Object],\n      author: String,\n      thumbnails: Array[Object] // Array of objects with links to images\n   }\n}\n\n ```\n\n### Proxy (HTTP Agent)\nIn order to use a proxy, you have to provide an assembled HTTP Agent. This can be achieved via additional packages like https-proxy-agent:\n```\nimport HttpsProxyAgent from 'https-proxy-agent';\nconst proxy = 'http://127.0.0.1:10003';\nconst httpAgent = HttpsProxyAgent(proxy);\n```\n\n## Tests\n\nTests and code standards are still in the process of being created.  Check back later for information on how tests should be performed.\n\n## Contribution\n\nPRs 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.\n\n## Credits\n\nThis is a fork of the `youtube-grabber-js` module created by OlegRom4ig\n\nView the original project on [NPM](https://www.npmjs.com/package/youtube-grabber-js) or [GitLab](https://gitlab.com/olroma123/youtube-grabber-nodejs)\n\n## License\n\nYou have explicit permission to use this project as stated in the terms of the [ISC license](https://github.com/FreeTubeApp/yt-channel-info/blob/master/LICENSE).\n","readmeFilename":"README.md"}