-
Notifications
You must be signed in to change notification settings - Fork 161
Description
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}}"})