1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Fixtures/Thumbnail+Fixtures.swift

20 lines
662 B
Swift
Raw Normal View History

2021-07-22 18:13:13 +05:30
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 16:19:57 +05:30
"https://invidious.snopyta.org"
2021-07-22 18:13:13 +05:30
}
private static func fixtureUrl(videoId: String, quality: Thumbnail.Quality) -> URL {
2021-10-21 03:51:50 +05:30
URL(string: "\(fixturesHost)/vi/\(videoId)/\(quality.filename).jpg")!
2021-07-22 18:13:13 +05:30
}
}