summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-08-12 09:46:47 -0500
committerOmar Roth <omarroth@hotmail.com>2018-08-12 09:46:47 -0500
commit43b2beeaaf4a94b94340a4de81c33029d9eb7bb0 (patch)
treefa2f761e2366b8874db47f93e78c991d896ccc2a /src
parent430d9347f9d6d1a7b806423bef0092945dbcc809 (diff)
downloadinvidious-43b2beeaaf4a94b94340a4de81c33029d9eb7bb0.tar.gz
invidious-43b2beeaaf4a94b94340a4de81c33029d9eb7bb0.tar.bz2
invidious-43b2beeaaf4a94b94340a4de81c33029d9eb7bb0.zip
Add 'maxresdefault', 'sddefault', to thumbnails
Diffstat (limited to 'src')
-rw-r--r--src/invidious/videos.cr25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index 504345fb..ac16f0fd 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -108,6 +108,17 @@ CAPTION_LANGUAGES = [
"Zulu",
]
+VIDEO_THUMBNAILS = [
+ {name: "default", url: "default", height: 90, width: 120},
+ {name: "medium", url: "mqdefault", height: 180, width: 320},
+ {name: "high", url: "hqdefault", height: 360, width: 480},
+ {name: "sddefault", url: "sddefault", height: 480, width: 640},
+ {name: "maxresdefault", url: "maxresdefault", height: 1280, width: 720},
+ {name: "start", url: "1", height: 90, width: 120},
+ {name: "middle", url: "2", height: 90, width: 120},
+ {name: "end", url: "3", height: 90, width: 120},
+]
+
# See https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L380-#L476
VIDEO_FORMATS = {
"5" => {"ext" => "flv", "width" => 400, "height" => 240, "acodec" => "mp3", "abr" => 64, "vcodec" => "h263"},
@@ -488,17 +499,13 @@ def process_video_params(query, preferences)
end
def generate_thumbnails(json, id)
- qualities = [{name: "default", url: "default", width: 120, height: 90},
- {name: "high", url: "hqdefault", width: 480, height: 360},
- {name: "medium", url: "mqdefault", width: 320, height: 180},
- ]
json.array do
- qualities.each do |quality|
+ VIDEO_THUMBNAILS.each do |thumbnail|
json.object do
- json.field "quality", quality[:name]
- json.field "url", "https://i.ytimg.com/vi/#{id}/#{quality["url"]}.jpg"
- json.field "width", quality[:width]
- json.field "height", quality[:height]
+ json.field "quality", thumbnail[:name]
+ json.field "url", "https://i.ytimg.com/vi/#{id}/#{thumbnail["url"]}.jpg"
+ json.field "width", thumbnail[:width]
+ json.field "height", thumbnail[:height]
end
end
end