mirror of
				https://github.com/yattee/yattee.git
				synced 2025-10-31 20:52:04 +00:00 
			
		
		
		
	Add upstream fix for Invidious thumbnails
On John Ternus request (@llsc12)
This commit is contained in:
		| @@ -439,8 +439,23 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI { | ||||
|     } | ||||
|  | ||||
|     private func extractThumbnails(from details: JSON) -> [Thumbnail] { | ||||
|         details["videoThumbnails"].arrayValue.map { json in | ||||
|             Thumbnail(url: json["url"].url!, quality: .init(rawValue: json["quality"].string!)!) | ||||
|         details["videoThumbnails"].arrayValue.compactMap { json in | ||||
|             guard let url = json["url"].url, | ||||
|                   var components = URLComponents(url: url, resolvingAgainstBaseURL: false), | ||||
|                   let quality = json["quality"].string | ||||
|             else { | ||||
|                 return nil | ||||
|             } | ||||
|  | ||||
|             // some of instances are not configured properly and return http thumbnails links | ||||
|             // http connections are not allowed in the app so we can safely convert it to https | ||||
|             components.scheme = "https" | ||||
|  | ||||
|             guard let thumbnailUrl = components.url else { | ||||
|                 return nil | ||||
|             } | ||||
|  | ||||
|             return Thumbnail(url: thumbnailUrl, quality: .init(rawValue: quality)!) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Arkadiusz Fal
					Arkadiusz Fal