Closed kooki45 closed 1 year ago
I think this happens because YouTube now has a separate tab for Short
and Live
on channel page, so currently there's no way to get channel's shorts and live streams.
I think this happens because YouTube now has a separate tab for
Short
andLive
on channel page, so currently there's no way to get channel's shorts and live streams.
Are You sure? I see https://github.com/LuanRT/YouTube.js can do it.
so currently there's no way to get channel's shorts and live streams
by that, I mean there's no way to do that using this library.
shorts
and live
are now on channel
on dev branch, you can use the dev branch by running
npm i git://github.com/suspiciouslookingowl/youtubei.git#dist
although I'm planning to do some (possibly breaking) changes before merging to main
Hi SuspiciousLookingOwl, Hope you are well :)
I was trying to get past live streams and it seems
const channelVideos = channel?.live
returns undefined
However I can get the first 14 live streams if I use
const channelVideos = channel?.shelves[0].items.length
Could I be doing something wrong when using channel.live?
@CharlesKiarie make sure you are already using the dev branch.
Can you give me a channel id for an example? I just tried the code locally and it works fine.
Available on 1.2.0
with no breaking changes
@SuspiciousLookingOwl I installed the dev branch $ npm i git://github.com/suspiciouslookingowl/youtubei.git#dist
You can try this channel id UCP4nMSTdwU1KqYWu3UH5DHQ
.
I am using the getChannel
method and it returns a channel but const channelVideos = channel.live
returns undefined.
async function getLiveStreams() {
const channel = await youtube.getChannel("UCP4nMSTdwU1KqYWu3UH5DHQ");
const channelVideos = channel?.live
console.log(channelVideos) // returns undefined
}
getLiveStreams()
Appreciate any help
Just tested this code on Node and it's working fine
const channel = await client.getChannel("UCP4nMSTdwU1KqYWu3UH5DHQ");
if (channel) {
const live = await channel.live.next();
console.log(live[0].title); // 【WEEKLY SCHEDULE】feel free to hang out here~【NIJISANJI EN | Pomu Rainpuff】
}
Running it on backend side of Next.js (API routes) should work fine. If you are doing it on the client side, then that might the cause, because as far as I know, this library doesn't work on the browser due to CORS
Thanks I needed .next()
it works now. I also figured out using next with an argument of 0 .next(0)
gets all the vods. 🙏
p.s. I would love to help improve your documentation/readme something I can do over the weekend and make a pull request.
@CharlesKiarie there was a documentation error which was fixed here: https://github.com/SuspiciousLookingOwl/youtubei/commit/411cc17b75e7f01a3e9a88e4a93d3a948403a8fd
You should be able to read about ChannelLive and ChannelShorts on the doc now 😃
Is there a way to get channel streams / shorts ? I used to get a channel streams in channel.videos, but I cant find any streams in channel.videos anymore.
Thankyou