Merge pull request #3249 from iv-org/improve-extractor

pull/3258/head
Samantaz Fox 2 years ago
commit 9cc0418769
No known key found for this signature in database
GPG Key ID: F42821059186176E

@ -435,20 +435,22 @@ private module Extractors
raw_items = [] of JSON::Any raw_items = [] of JSON::Any
content = extract_selected_tab(target["tabs"])["content"] content = extract_selected_tab(target["tabs"])["content"]
content["sectionListRenderer"]["contents"].as_a.each do |renderer_container| if section_list_contents = content.dig?("sectionListRenderer", "contents")
renderer_container_contents = renderer_container["itemSectionRenderer"]["contents"][0] section_list_contents.as_a.each do |renderer_container|
renderer_container_contents = renderer_container["itemSectionRenderer"]["contents"][0]
# Category extraction
if items_container = renderer_container_contents["shelfRenderer"]? # Category extraction
raw_items << renderer_container_contents if items_container = renderer_container_contents["shelfRenderer"]?
next raw_items << renderer_container_contents
elsif items_container = renderer_container_contents["gridRenderer"]? next
else elsif items_container = renderer_container_contents["gridRenderer"]?
items_container = renderer_container_contents else
end items_container = renderer_container_contents
end
items_container["items"]?.try &.as_a.each do |item| items_container["items"]?.try &.as_a.each do |item|
raw_items << item raw_items << item
end
end end
end end

Loading…
Cancel
Save