|
|
@ -331,18 +331,8 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
next
|
|
|
|
next
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
anchor = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-byline")]/a))
|
|
|
|
author_id = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-byline")]/a)).try &.["href"].split("/")[-1] || ucid || ""
|
|
|
|
if anchor
|
|
|
|
author = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-byline")]/a)).try &.content.strip || author_name || ""
|
|
|
|
author = anchor.content.strip
|
|
|
|
|
|
|
|
author_id = anchor["href"].split("/")[-1]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
author ||= author_name
|
|
|
|
|
|
|
|
author_id ||= ucid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
author ||= ""
|
|
|
|
|
|
|
|
author_id ||= ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
description_html = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-description")])).try &.to_s || ""
|
|
|
|
description_html = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-description")])).try &.to_s || ""
|
|
|
|
|
|
|
|
|
|
|
|
tile = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-tile")]))
|
|
|
|
tile = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-tile")]))
|
|
|
@ -401,13 +391,13 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
playlist_thumbnail ||= node.xpath_node(%q(.//span/img)).try &.["src"]
|
|
|
|
playlist_thumbnail ||= node.xpath_node(%q(.//span/img)).try &.["src"]
|
|
|
|
|
|
|
|
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
title,
|
|
|
|
title: title,
|
|
|
|
plid,
|
|
|
|
id: plid,
|
|
|
|
author,
|
|
|
|
author: author,
|
|
|
|
author_id,
|
|
|
|
ucid: author_id,
|
|
|
|
video_count,
|
|
|
|
video_count: video_count,
|
|
|
|
videos,
|
|
|
|
videos: videos,
|
|
|
|
playlist_thumbnail
|
|
|
|
thumbnail: playlist_thumbnail
|
|
|
|
)
|
|
|
|
)
|
|
|
|
when .includes? "yt-lockup-channel"
|
|
|
|
when .includes? "yt-lockup-channel"
|
|
|
|
author = title.strip
|
|
|
|
author = title.strip
|
|
|
@ -577,13 +567,13 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
playlist_title,
|
|
|
|
title: playlist_title,
|
|
|
|
plid,
|
|
|
|
id: plid,
|
|
|
|
author_name,
|
|
|
|
author: author_name,
|
|
|
|
ucid,
|
|
|
|
ucid: ucid,
|
|
|
|
video_count,
|
|
|
|
video_count: video_count,
|
|
|
|
videos,
|
|
|
|
videos: videos,
|
|
|
|
playlist_thumbnail
|
|
|
|
thumbnail: playlist_thumbnail
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -592,13 +582,13 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
|
|
|
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
|
|
|
|
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
|
|
|
|
|
|
|
|
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
items << SearchPlaylist.new(
|
|
|
|
title,
|
|
|
|
title: title,
|
|
|
|
plid,
|
|
|
|
id: plid,
|
|
|
|
author_name,
|
|
|
|
author: author_name,
|
|
|
|
ucid,
|
|
|
|
ucid: ucid,
|
|
|
|
videos.size,
|
|
|
|
video_count: videos.size,
|
|
|
|
videos,
|
|
|
|
videos: videos,
|
|
|
|
"/vi/#{videos[0].id}/mqdefault.jpg"
|
|
|
|
thumbnail: "https://i.ytimg.com/vi/#{videos[0].id}/mqdefault.jpg"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|