|
|
@ -232,13 +232,22 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
playlist_thumbnail = node.xpath_node(%q(.//div/span/img)).try &.["data-thumb"]?
|
|
|
|
|
|
|
|
playlist_thumbnail ||= node.xpath_node(%q(.//div/span/img)).try &.["src"]
|
|
|
|
|
|
|
|
if !playlist_thumbnail || playlist_thumbnail.empty?
|
|
|
|
|
|
|
|
thumbnail_id = videos[0]?.try &.id
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
thumbnail_id = playlist_thumbnail.match(/\/vi\/(?<video_id>[a-zA-Z0-9_-]{11})\/\w+\.jpg/).try &.["video_id"]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
title,
|
|
|
|
title,
|
|
|
|
plid,
|
|
|
|
plid,
|
|
|
|
author,
|
|
|
|
author,
|
|
|
|
author_id,
|
|
|
|
author_id,
|
|
|
|
video_count,
|
|
|
|
video_count,
|
|
|
|
videos
|
|
|
|
videos,
|
|
|
|
|
|
|
|
thumbnail_id
|
|
|
|
)
|
|
|
|
)
|
|
|
|
when .includes? "yt-lockup-channel"
|
|
|
|
when .includes? "yt-lockup-channel"
|
|
|
|
author = title.strip
|
|
|
|
author = title.strip
|
|
|
@ -399,13 +408,22 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
playlist_title ||= ""
|
|
|
|
playlist_title ||= ""
|
|
|
|
plid ||= ""
|
|
|
|
plid ||= ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
playlist_thumbnail = child_node.xpath_node(%q(.//span/img)).try &.["data-thumb"]?
|
|
|
|
|
|
|
|
playlist_thumbnail ||= child_node.xpath_node(%q(.//span/img)).try &.["src"]
|
|
|
|
|
|
|
|
if !playlist_thumbnail || playlist_thumbnail.empty?
|
|
|
|
|
|
|
|
thumbnail_id = videos[0]?.try &.id
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
thumbnail_id = playlist_thumbnail.match(/\/vi\/(?<video_id>[a-zA-Z0-9_-]{11})\/\w+\.jpg/).try &.["video_id"]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
playlist_title,
|
|
|
|
playlist_title,
|
|
|
|
plid,
|
|
|
|
plid,
|
|
|
|
author_name,
|
|
|
|
author_name,
|
|
|
|
ucid,
|
|
|
|
ucid,
|
|
|
|
50,
|
|
|
|
50,
|
|
|
|
Array(SearchPlaylistVideo).new
|
|
|
|
Array(SearchPlaylistVideo).new,
|
|
|
|
|
|
|
|
thumbnail_id
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -419,7 +437,8 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
author_name,
|
|
|
|
author_name,
|
|
|
|
ucid,
|
|
|
|
ucid,
|
|
|
|
videos.size,
|
|
|
|
videos.size,
|
|
|
|
videos
|
|
|
|
videos,
|
|
|
|
|
|
|
|
videos[0].try &.id
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|