1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Fixtures/Thumbnail+Fixtures.swift
2021-10-21 01:56:40 +02:00

20 lines
665 B
Swift

import Foundation
extension Thumbnail {
static func fixture(videoId: String, quality: Thumbnail.Quality = .maxres) -> Thumbnail {
Thumbnail(url: fixtureUrl(videoId: videoId, quality: quality), quality: quality)
}
static func fixturesForAllQualities(videoId: String) -> [Thumbnail] {
Thumbnail.Quality.allCases.map { fixture(videoId: videoId, quality: $0) }
}
private static var fixturesHost: String {
"https://invidious.home.arekf.net"
}
private static func fixtureUrl(videoId: String, quality: Thumbnail.Quality) -> URL {
URL(string: "\(fixturesHost)/vi/\(videoId)/\(quality.filename).jpg")!
}
}