Open datnt opened 10 years ago
My script use a lot of external stuff so these are just pulled out snippets but maybe they can help you. They are part of a script which I posted earlier in an issue of mine. It updated titles, descriptions, etc. and also handled duplicate videos rejected by youtube...
I had a task to find "broken" videos. The result looks like this:
|~PROC~> Find broken/unpublished videos...
|~> BsKiTyjiN3U restricted – Reason: This video is not available in your region.
|~> Mxx_IjKqCtA restricted – Reason: This video is not available in your region.
|~> -eR5GkRON8c restricted – Reason: Syndication of this video was restricted.
|~> gGZChY4AFBQ restricted – Reason: This video is not available in your region.
|~> 6jGKgigBkjc restricted – Reason: Syndication of this video was restricted.
|~> iGOs3WbUxFM processing – Reason:
|~> jzD4YC7cFRw restricted – Reason: Syndication of this video was restricted.
|~> pgdK7LC7vpk restricted – Reason: This video is not available in your region.
|~> MfT_Ta4YyPc restricted – Reason: Syndication of this video was restricted.
|~> RSvxRlRnV_c restricted – Reason: Syndication of this video was restricted.
|~> xyggRQXk9iM restricted – Reason: This video is not available in your region.
|~> dV-b5_3TvnU restricted – Reason: This video is not available in your region.
The code is more or less:
def find_broken
collect_all_videos.each do |v|
unless v.state[:name] == "published"
puts "|~> #{v.unique_id} #{v.state[:name]} #{v.state[:copy].nil? ? "" : "– Reason: #{v.state[:copy]}"}"
end
end
end
def collect_all_videos
page = 0
base = []
while true
page += 1
more = @connection.my_videos(page: page).videos
break if more.length == 0
base += more
end
base
end
Thank you for great gem.
Is there anyway to handle in the cases that youtube return error code after upload? What happen when we query for video(s) that are in processing status on youtube?