diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-04 09:50:24 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-04 09:50:24 -0500 |
| commit | b3cad0355b6575d1533d30e32e07ca30f21634af (patch) | |
| tree | 68d26927251e2e8ff7494976924b0a77cd1f424c /src | |
| parent | 9fd0a02f1682ce95dce60c5bd7523af47f14397e (diff) | |
| download | invidious-b3cad0355b6575d1533d30e32e07ca30f21634af.tar.gz invidious-b3cad0355b6575d1533d30e32e07ca30f21634af.tar.bz2 invidious-b3cad0355b6575d1533d30e32e07ca30f21634af.zip | |
Add fix for vdieo thumbnails where video is not HD
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 12 | ||||
| -rw-r--r-- | src/invidious/views/watch.ecr | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index d357ad5e..5af868c5 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -439,7 +439,11 @@ get "/watch" do |env| host_params = env.request.query_params host_params.delete_all("v") - thumbnail = "https://i.ytimg.com/vi/#{id}/maxresdefault.jpg" + if fmt_stream.select { |x| x["label"].starts_with? "hd720" }.size != 0 + thumbnail = "https://i.ytimg.com/vi/#{video.id}/maxresdefault.jpg" + else + thumbnail = "https://i.ytimg.com/vi/#{video.id}/hqdefault.jpg" + end templated "watch" end @@ -1525,7 +1529,11 @@ get "/embed/:id" do |env| host_params = env.request.query_params host_params.delete_all("v") - thumbnail = "https://i.ytimg.com/vi/#{id}/maxresdefault.jpg" + if fmt_stream.select { |x| x["label"].starts_with? "hd720" }.size != 0 + thumbnail = "https://i.ytimg.com/vi/#{video.id}/maxresdefault.jpg" + else + thumbnail = "https://i.ytimg.com/vi/#{video.id}/hqdefault.jpg" + end rendered "embed" end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index b6119468..8ee9b568 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -18,7 +18,7 @@ <meta name="twitter:url" content="<%= host_url %>/watch?v=<%= video.id %>"> <meta name="twitter:title" content="<%= HTML.escape(video.title) %>"> <meta name="twitter:description" content="<%= description %>"> -<meta name="twitter:image" content="https://i.ytimg.com/vi/<%= video.id %>/maxresdefault.jpg"> +<meta name="twitter:image" content="<%= thumbnail %>"> <meta name="twitter:player" content="<%= host_url %>/embed/<%= video.id %>"> <meta name="twitter:player:width" content="1280"> <meta name="twitter:player:height" content="720"> |
