mirror of
https://github.com/yattee/yattee.git
synced 2024-12-12 21:30:32 +05:30
Change date parsing from Invidious
This commit is contained in:
parent
2a7c51abda
commit
4fc2f964b2
@ -19,7 +19,9 @@ extension Double {
|
|||||||
let date = Date(timeIntervalSince1970: self)
|
let date = Date(timeIntervalSince1970: self)
|
||||||
|
|
||||||
let formatter = RelativeDateTimeFormatter()
|
let formatter = RelativeDateTimeFormatter()
|
||||||
formatter.unitsStyle = .full
|
formatter.dateTimeStyle = .named
|
||||||
|
formatter.unitsStyle = .short
|
||||||
|
formatter.formattingContext = .standalone
|
||||||
|
|
||||||
return formatter.localizedString(for: date, relativeTo: Date())
|
return formatter.localizedString(for: date, relativeTo: Date())
|
||||||
}
|
}
|
||||||
|
@ -460,10 +460,12 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
func extractVideo(from json: JSON) -> Video {
|
func extractVideo(from json: JSON) -> Video {
|
||||||
let indexID: String?
|
let indexID: String?
|
||||||
var id: Video.ID
|
var id: Video.ID
|
||||||
|
var published = json["publishedText"].stringValue
|
||||||
var publishedAt: Date?
|
var publishedAt: Date?
|
||||||
|
|
||||||
if let publishedInterval = json["published"].double {
|
if let publishedInterval = json["published"].double {
|
||||||
publishedAt = Date(timeIntervalSince1970: publishedInterval)
|
publishedAt = Date(timeIntervalSince1970: publishedInterval)
|
||||||
|
published = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
let videoID = json["videoId"].stringValue
|
let videoID = json["videoId"].stringValue
|
||||||
@ -486,7 +488,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
title: json["title"].stringValue,
|
title: json["title"].stringValue,
|
||||||
author: json["author"].stringValue,
|
author: json["author"].stringValue,
|
||||||
length: json["lengthSeconds"].doubleValue,
|
length: json["lengthSeconds"].doubleValue,
|
||||||
published: json["publishedText"].stringValue,
|
published: published,
|
||||||
views: json["viewCount"].intValue,
|
views: json["viewCount"].intValue,
|
||||||
description: description,
|
description: description,
|
||||||
genre: json["genre"].stringValue,
|
genre: json["genre"].stringValue,
|
||||||
|
Loading…
Reference in New Issue
Block a user