Fix 'Lint/UselessAssign' warnings reported by ameba

pull/2827/head
Samantaz Fox 3 years ago
parent 46f7ca9ffa
commit 971b6ec96f
No known key found for this signature in database
GPG Key ID: F42821059186176E

@ -93,10 +93,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
end end
contents = body["contents"]? contents = body["contents"]?
header = body["header"]? header = body["header"]?
if body["continuations"]?
# Removable? Doesn't seem like this is used.
more_replies_continuation = body["continuations"][0]["nextContinuationData"]["continuation"].as_s
end
else else
raise InfoException.new("Could not fetch comments") raise InfoException.new("Could not fetch comments")
end end

@ -463,7 +463,6 @@ def extract_playlist_videos(initial_data : Hash(String, JSON::Any))
plid = i["navigationEndpoint"]["watchEndpoint"]["playlistId"].as_s plid = i["navigationEndpoint"]["watchEndpoint"]["playlistId"].as_s
index = i["navigationEndpoint"]["watchEndpoint"]["index"].as_i64 index = i["navigationEndpoint"]["watchEndpoint"]["index"].as_i64
thumbnail = i["thumbnail"]["thumbnails"][0]["url"].as_s
title = i["title"].try { |t| t["simpleText"]? || t["runs"]?.try &.[0]["text"]? }.try &.as_s || "" title = i["title"].try { |t| t["simpleText"]? || t["runs"]?.try &.[0]["text"]? }.try &.as_s || ""
author = i["shortBylineText"]?.try &.["runs"][0]["text"].as_s || "" author = i["shortBylineText"]?.try &.["runs"][0]["text"].as_s || ""
ucid = i["shortBylineText"]?.try &.["runs"][0]["navigationEndpoint"]["browseEndpoint"]["browseId"].as_s || "" ucid = i["shortBylineText"]?.try &.["runs"][0]["navigationEndpoint"]["browseEndpoint"]["browseId"].as_s || ""

@ -65,7 +65,6 @@ def fetch_user(sid, headers)
feed = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers) feed = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers)
feed = XML.parse_html(feed.body) feed = XML.parse_html(feed.body)
channels = [] of String
channels = feed.xpath_nodes(%q(//ul[@id="guide-channels"]/li/a)).compact_map do |channel| channels = feed.xpath_nodes(%q(//ul[@id="guide-channels"]/li/a)).compact_map do |channel|
if {"Popular on YouTube", "Music", "Sports", "Gaming"}.includes? channel["title"] if {"Popular on YouTube", "Music", "Sports", "Gaming"}.includes? channel["title"]
nil nil
@ -157,12 +156,11 @@ def generate_captcha(key)
</svg> </svg>
END_SVG END_SVG
image = "" image = "data:image/png;base64,"
convert = Process.run(%(rsvg-convert -w 400 -h 400 -b none -f png), shell: true, image += Process.run(%(rsvg-convert -w 400 -h 400 -b none -f png), shell: true,
input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe) do |proc| input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe
image = proc.output.gets_to_end ) do |proc|
image = Base64.strict_encode(image) Base64.strict_encode(proc.output.gets_to_end)
image = "data:image/png;base64,#{image}"
end end
answer = "#{hour}:#{minute.to_s.rjust(2, '0')}:#{second.to_s.rjust(2, '0')}" answer = "#{hour}:#{minute.to_s.rjust(2, '0')}:#{second.to_s.rjust(2, '0')}"

Loading…
Cancel
Save