2021-07-22 12:43:13 +00:00
|
|
|
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 {
|
2022-03-27 10:49:57 +00:00
|
|
|
"https://invidious.snopyta.org"
|
2021-07-22 12:43:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private static func fixtureUrl(videoId: String, quality: Thumbnail.Quality) -> URL {
|
2021-10-20 22:21:50 +00:00
|
|
|
URL(string: "\(fixturesHost)/vi/\(videoId)/\(quality.filename).jpg")!
|
2021-07-22 12:43:13 +00:00
|
|
|
}
|
|
|
|
}
|