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

"Processing abandoned" videos returning Yt::Errors::NoItems #402

Open
benclum11 opened this issue Jan 20, 2021 · 5 comments
Open

"Processing abandoned" videos returning Yt::Errors::NoItems #402

benclum11 opened this issue Jan 20, 2021 · 5 comments

Comments

@benclum11
Copy link

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}}"})
@bradleygauthier
Copy link

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.

@kangkyu
Copy link
Contributor

kangkyu commented Jun 20, 2022

begin
  ...
rescue Yt::Errors::NoItems
end

I think this is a good workaround for your case

@benclum11
Copy link
Author

@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.

@kangkyu
Copy link
Contributor

kangkyu commented Oct 29, 2022

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.

@kangkyu
Copy link
Contributor

kangkyu commented Sep 27, 2023

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

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