mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Fix Invidious channel videos
This commit is contained in:
parent
2b238c9b7b
commit
cfd85a018e
@ -114,7 +114,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
||||
}
|
||||
|
||||
configureTransformer(pathPattern("channels/*/latest"), requestMethods: [.get]) { (content: Entity<JSON>) -> [Video] in
|
||||
content.json.arrayValue.map(self.extractVideo)
|
||||
content.json.dictionaryValue["videos"]?.arrayValue.map(self.extractVideo) ?? []
|
||||
}
|
||||
|
||||
configureTransformer(pathPattern("channels/*/playlists"), requestMethods: [.get]) { (content: Entity<JSON>) -> [ContentItem] in
|
||||
|
@ -72,14 +72,21 @@ struct FavoriteItemView: View {
|
||||
}
|
||||
}
|
||||
case let .channel(_, id, name):
|
||||
let channel = Channel(app: .invidious, id: id, name: name)
|
||||
if let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey) {
|
||||
var channel = Channel(app: .invidious, id: id, name: name)
|
||||
if let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey),
|
||||
!cache.videos.isEmpty
|
||||
{
|
||||
contentItems = ContentItem.array(of: cache.videos)
|
||||
}
|
||||
|
||||
onSuccess = { response in
|
||||
if let channel: Channel = response.typedContent() {
|
||||
ChannelsCacheModel.shared.store(channel)
|
||||
store.contentItems = ContentItem.array(of: channel.videos)
|
||||
} else if let videos: [Video] = response.typedContent() {
|
||||
channel.videos = videos
|
||||
ChannelsCacheModel.shared.store(channel)
|
||||
store.contentItems = ContentItem.array(of: videos)
|
||||
}
|
||||
}
|
||||
case let .channelPlaylist(_, id, title):
|
||||
|
Loading…
Reference in New Issue
Block a user