Messaggi chiari per errori YouTube API in creazione diretta.
Include guida su liveStreamingNotEnabled e token non validi. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -46,7 +46,7 @@ module Youtube
|
||||
rtmp_url: stream_result.cdn.ingestion_info.ingestion_address
|
||||
}
|
||||
rescue Google::Apis::Error => e
|
||||
raise Error, e.message
|
||||
raise Error, friendly_api_error(e)
|
||||
end
|
||||
|
||||
def complete_broadcast!(broadcast_id)
|
||||
@@ -86,5 +86,13 @@ module Youtube
|
||||
def authorized_client
|
||||
OauthRefresh.new(@credential).apply!(Google::Apis::YoutubeV3::YouTubeService.new)
|
||||
end
|
||||
|
||||
def friendly_api_error(error)
|
||||
msg = error.message.to_s
|
||||
return "Il canale YouTube non ha la diretta attiva. Apri YouTube Studio con l’account del canale Match Live TV, abilita la live (verifica telefono se richiesto) e riprova." if msg.include?("liveStreamingNotEnabled")
|
||||
return "Credenziali YouTube non valide. Ricollega il canale dalla sezione Admin → YouTube." if msg.match?(/Unauthorized|invalid_grant/i)
|
||||
|
||||
msg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user