Fix playlist_thumbnail extractor

This commit is contained in:
Omar Roth 2019-08-16 20:06:21 -05:00
parent e6b4e12689
commit 2b94975345
No known key found for this signature in database
GPG key ID: B8254FB7EC3D37F2
3 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,8 @@
html, html,
body { body {
font-family: BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif; font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica,
Arial, sans-serif;
} }
.deleted { .deleted {
@ -108,6 +110,7 @@ img.thumbnail {
height: 100%; height: 100%;
left: 0; left: 0;
top: 0; top: 0;
object-fit: cover;
} }
.length { .length {
@ -452,6 +455,6 @@ video.video-js {
*/ */
top: 50%; top: 50%;
left: 50%; left: 50%;
margin-top: -.81666em; margin-top: -0.81666em;
margin-left: -1.5em; margin-left: -1.5em;
} }

View file

@ -3003,7 +3003,7 @@ get "/user/:user/about" do |env|
env.redirect "/channel/#{user}" env.redirect "/channel/#{user}"
end end
get "/channel:ucid/about" do |env| get "/channel/:ucid/about" do |env|
ucid = env.params.url["ucid"] ucid = env.params.url["ucid"]
env.redirect "/channel/#{ucid}" env.redirect "/channel/#{ucid}"
end end
@ -3107,8 +3107,7 @@ get "/channel/:ucid/playlists" do |env|
end end
items, continuation = fetch_channel_playlists(channel.ucid, channel.author, channel.auto_generated, continuation, sort_by) items, continuation = fetch_channel_playlists(channel.ucid, channel.author, channel.auto_generated, continuation, sort_by)
items.select! { |item| item.is_a?(SearchPlaylist) && !item.videos.empty? } items = items.select { |item| item.is_a?(SearchPlaylist) }.map { |item| item.as(SearchPlaylist) }
items = items.map { |item| item.as(SearchPlaylist) }
items.each { |item| item.author = "" } items.each { |item| item.author = "" }
env.set "search", "channel:#{channel.ucid} " env.set "search", "channel:#{channel.ucid} "

View file

@ -397,8 +397,8 @@ 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(.//span/img)).try &.["data-thumb"]?
playlist_thumbnail ||= node.xpath_node(%q(.//div/span/img)).try &.["src"] playlist_thumbnail ||= node.xpath_node(%q(.//span/img)).try &.["src"]
items << SearchPlaylist.new( items << SearchPlaylist.new(
title, title,