Don't continue when LOGIN_REQUIRED and no videoDetails
This commit is contained in:
parent
05258d56bd
commit
d6087fac47
1 changed files with 4 additions and 2 deletions
|
@ -66,8 +66,10 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
|
||||||
reason ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("")
|
reason ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("")
|
||||||
reason ||= player_response.dig("playabilityStatus", "reason").as_s
|
reason ||= player_response.dig("playabilityStatus", "reason").as_s
|
||||||
|
|
||||||
# Stop here if video is not a scheduled livestream
|
# Stop here if video is not a scheduled livestream or
|
||||||
if !{"LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status)
|
# for LOGIN_REQUIRED when videoDetails element is not found because retrying won't help
|
||||||
|
if !{"LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status) ||
|
||||||
|
playability_status == "LOGIN_REQUIRED" && !player_response.dig?("videoDetails")
|
||||||
return {
|
return {
|
||||||
"version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),
|
"version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),
|
||||||
"reason" => JSON::Any.new(reason),
|
"reason" => JSON::Any.new(reason),
|
||||||
|
|
Loading…
Reference in a new issue