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,
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 {
@ -108,6 +110,7 @@ img.thumbnail {
height: 100%;
left: 0;
top: 0;
object-fit: cover;
}
.length {
@ -442,8 +445,8 @@ video.video-js {
}
.video-js.player-style-youtube .vjs-control-bar {
display: flex;
flex-direction: row;
display: flex;
flex-direction: row;
}
.video-js.player-style-youtube .vjs-big-play-button {
/*
@ -452,6 +455,6 @@ video.video-js {
*/
top: 50%;
left: 50%;
margin-top: -.81666em;
margin-top: -0.81666em;
margin-left: -1.5em;
}

View file

@ -3003,7 +3003,7 @@ get "/user/:user/about" do |env|
env.redirect "/channel/#{user}"
end
get "/channel:ucid/about" do |env|
get "/channel/:ucid/about" do |env|
ucid = env.params.url["ucid"]
env.redirect "/channel/#{ucid}"
end
@ -3107,8 +3107,7 @@ get "/channel/:ucid/playlists" do |env|
end
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.map { |item| item.as(SearchPlaylist) }
items = items.select { |item| item.is_a?(SearchPlaylist) }.map { |item| item.as(SearchPlaylist) }
items.each { |item| item.author = "" }
env.set "search", "channel:#{channel.ucid} "

View file

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