yt
yt copied to clipboard
"Processing abandoned" videos returning Yt::Errors::NoItems
When fetching all videos that an authenticated Account
object has available (unlisted, public, and private), the gem is throwing a Yt::Errors::NoItems error on failed videos. I think the issue is that youtube doesn't return these videos via the API, and in turn, the gem (correctly) throws a NoItems error. Consequently since an error is raised, I'm unable to get the full list of videos for the account. the account in question has over 600 videos, and it's only returning 100 or so due to the exception being thrown in the middle of fetching the videos. Is it possible to skip videos and not throw an exception when fetching failed videos?
If it helps, the video's status is VIDEO_STATUS_FAILED
and the detailed status is VIDEO_STATUS_DETAIL_FAILED_UNKNOWN
. the error message in the creator UI is "Processing abandoned. The video could not be processed."
sample code that fetches all videos for an account:
videos = []
account = Yt::Account.new refresh_token: REFRESH_TOKEN
account.videos.each do |video|
videos <<= { url: video.id, thumbnail: video.thumbnail_url, title: video.title }
end
sample response/error from the gem:
Yt::Errors::NoItems
({"request_curl":"curl -X GET -H \"content-length: 0\" -H \"user-agent: Yt::Request (gzip)\" -H \"authorization: Bearer AUTH_TOKEN\" -H \"host: www.googleapis.com\" \"https://www.googleapis.com/youtube/v3/videos?id=VIDEO_ID\u0026part=snippet\"","response_body":"{\"kind\":\"youtube#videoListResponse\",\"etag\":\"ETAG\",\"items\":[],\"pageInfo\":{\"totalResults\":0,\"resultsPerPage\":0}}"})
I believe this is because the video has been removed from YouTube because of a violation to the terms of service. It's still in the list of videos, but it doesn't have all of the additional information, like title.
begin
...
rescue Yt::Errors::NoItems
end
I think this is a good workaround for your case
@kangkyu this is actually the solution we ended up using, but it doesn't actually solve the problem. we had to actually go in and delete the "broken" video that was causing the error.
For example, if the account has 600 videos, and the 100th video is "broken", then the gem is only able to fetch the first 129 videos, and the rest of the 499 videos won't be able to be fetched.
Sorry I missed your comment. It was not possible to skip the broken video, when get information of other videos? Interesting
It sounds like you were able to get only some part of videos even though it skips, but you were able to get all the video information, when you come back after removing the broken video.
Do you still consider it as something the gem can fix?
If it helps, the video's status is VIDEO_STATUS_FAILED and the detailed status is VIDEO_STATUS_DETAIL_FAILED_UNKNOWN. the error message in the creator UI is "Processing abandoned. The video could not be processed."
Even though we know the response for that case (status and error message) we still cannot pull all the videos because of that broken video.. no? We still should remove that video separately. Do you want to see a different error something like Yt::Errors::BrokenVideo
? @benclum11