Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in list_channel_videos function #88

Open
sujinz opened this issue Jun 3, 2020 · 5 comments
Open

error in list_channel_videos function #88

sujinz opened this issue Jun 3, 2020 · 5 comments

Comments

@sujinz
Copy link

sujinz commented Jun 3, 2020

I tried to get video stats using this code, and it worked until May 3rd.
But, it does not work for now.

for(i in 1:length(chID)) ##chID=lists of channel IDs
{
chName <- sub$channelName[i]
vl <- list_channel_videos(as.character(chID[i]), max_results = 50000) # {tuber}

tmp <- cbind(chName, vl)
videoList.for <- rbind(videoList.for, tmp) # 26 channels

print(paste(i, "channel"))
}
videoList <- videoList.for
names(videoList)

In the past, it appeared like this,
[1] "chName" ".id" "kind" "etag"
[5] "id" "contentDetails.videoId" "kst"

But for now,
"chName" ".id" "X[[i]]"
in ".id " I can only see pageInfo.totalResults and pageInfo.resultsPerPage,

Is there any alternative codes to extract video ids and stats?

@sujinz
Copy link
Author

sujinz commented Jun 4, 2020

I tried the way you suggested, but there's a limitation. yt_search's max results only takes the value between 0 to 50, but I want to bring all video stats in individual channels.

@MaximilianKrauss
Copy link
Contributor

MaximilianKrauss commented Jun 4, 2020

I am sorry for having broken the discussion's history. When I realized shortly after posting that my and your, @sujinz, problem actually belong to different functions (get_all_channel_video_stats() versus list_channel_videos(), I deleted my reply and opened a separate issue #89 instead. I should have just edited my reply.

To at least add the missing core information: I had suggested to you, @sujinz, to consider yt_search(channel_id, type = "video") and to feed get_stats() as a workaround, but did so while thinking our issues belong to the same function. The purpose of list_channel_videos() is different, though, and my workaround does not apply.

Have you tried yt_search(channel_id, type = "playlist")? Then, the results limit should apply to 50 playlists instead of 50 videos, which should return more information about more videos. But I see that list_channel_videos(max_results) can be set to over 50 to include all videos from a playlist. I am not sure in how far my suggestion will work.

@sujinz
Copy link
Author

sujinz commented Jun 4, 2020

thanks for your sincere responses! with yt_search function, I think it's not easy to find exact info that I want, but I will try it :) @Sasyriston

@MaximilianKrauss
Copy link
Contributor

@sujinz It seems the code changes of pull request #84 indirectly fixes your issue, because list_channel_videos() calls get_playlist_items(simplify = TRUE) internally. In the current release version of tuber being 0.9.8, its simplifying algorithm is outdated and produces the incomplete output you described. As a result, list_channel_videos() does not get the information it expects and returns the error when it tries to use the missing information.
The function I used in my issue #89 likewise relies on the currently incomplete output of get_playlist_items(simplify = TRUE), which is why I thought at first that you and me have the same problem. :)
The next release version will contain this fix, but you can install the GitHub version via devtools::install_github() (see Installation section on the repository's main page) right away for this issue to be resolved.

@durraniu
Copy link

Is there a fix yet to the list_channel_videos() function? As per the documentation, specifying a value >50 should return all videos of the channel but it still throws the Error in get_playlist_items(filter = c(playlist_id = playlist_id), max_results = max_results, : max_results must be a value between 0 and 50.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants