Organize the code better

Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>
This commit is contained in:
RadoslavL 2023-11-12 20:52:11 +02:00 committed by GitHub
parent 7388e4ca72
commit 50da6cf3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,9 +237,9 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
.dig?("secondaryResults", "secondaryResults", "results")
secondary_results.try &.as_a.each do |element|
if item = element["compactVideoRenderer"]?
if item["publishedTimeText"]?
rv_published_time_text = item["publishedTimeText"].to_s
rv_decoded_time = decode_date(item["publishedTimeText"].to_s)
if rv_published_time_text = item["publishedTimeText"]?
rv_published_time_text = rv_published_time_text.as_s
rv_decoded_time = decode_date(rv_published_time_text)
rv_published_timestamp = rv_decoded_time.to_unix.to_s
else
rv_published_timestamp = nil