mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add 'maxresdefault', 'sddefault', to thumbnails
This commit is contained in:
parent
430d9347f9
commit
43b2beeaaf
1 changed files with 16 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue