SuspiciousLookingOwl / youtubei

Get Youtube data such as videos, playlists, channels, video information & comments, related videos, up next video, and more!
https://suspiciouslookingowl.github.io/youtubei
MIT License
240 stars 50 forks source link

v1 Migration Guide #54

Closed SuspiciousLookingOwl closed 2 years ago

SuspiciousLookingOwl commented 2 years ago

v1 is now finally on RC!

The 0-rc version won't be maintained anymore.

New v1 docs: https://suspiciouslookingowl.github.io/youtubei

Migration Guide

List of breaking changes on v1:

  1. youtubei now requires Node version >= 16
  2. ChannelCompact renamed to BaseChannel
  3. Comment#isPinnedComment renamed to Comment#isPinned
  4. Client constructor parameters changes:
    1. cookie renamed to initialCookie
    2. requestOptions changed to fetchOptions (which is a node-fetch request options)
    3. https removed
  5. Remove URL support from Client#getVideo and Client#getPlaylist, you will have to extract video / playlist id from URL string before passing it
  6. SearchResult now is a Continuable (look below)
  7. Continuable implementations. All .next*() methods in all classes will be removed (e.g. Channel#nextVideos, Channel#nextPlaylists, or Video#nextComments), and the property used to store fetched data (e.g Channel.videos, Channel.playlists, or Video.comments) will be replaced with a Continuable. Instead of doing:
    
    await channel.nextVideos();
    await channel.nextPlaylists();
    await video.nextComments();

console.log(channel.videos, channel.playlists, video.comments);

on v1:
```ts
await channel.videos.next();
await channel.playlists.next();
await video.comments.next();

console.log(channel.videos.items, channel.playlists.items, video.comments.items);