mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix date parsing for piped videos
This commit is contained in:
parent
8258d8d5b4
commit
0ffb9d0606
@ -496,7 +496,17 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
|||||||
|
|
||||||
let uploaded = details["uploaded"]?.double
|
let uploaded = details["uploaded"]?.double
|
||||||
var published = (uploaded.isNil || uploaded == -1) ? nil : (uploaded! / 1000).formattedAsRelativeTime()
|
var published = (uploaded.isNil || uploaded == -1) ? nil : (uploaded! / 1000).formattedAsRelativeTime()
|
||||||
if published.isNil {
|
var publishedAt: Date?
|
||||||
|
|
||||||
|
let dateFormatter = ISO8601DateFormatter()
|
||||||
|
dateFormatter.formatOptions = [.withInternetDateTime]
|
||||||
|
|
||||||
|
if published.isNil,
|
||||||
|
let date = details["uploadDate"]?.string,
|
||||||
|
let formattedDate = dateFormatter.date(from: date)
|
||||||
|
{
|
||||||
|
publishedAt = formattedDate
|
||||||
|
} else {
|
||||||
published = (details["uploadedDate"] ?? details["uploadDate"])?.string ?? ""
|
published = (details["uploadedDate"] ?? details["uploadDate"])?.string ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,6 +536,7 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
|||||||
thumbnails: thumbnails,
|
thumbnails: thumbnails,
|
||||||
live: live,
|
live: live,
|
||||||
short: details["isShort"]?.bool ?? (length <= Video.shortLength),
|
short: details["isShort"]?.bool ?? (length <= Video.shortLength),
|
||||||
|
publishedAt: publishedAt,
|
||||||
likes: details["likes"]?.int,
|
likes: details["likes"]?.int,
|
||||||
dislikes: details["dislikes"]?.int,
|
dislikes: details["dislikes"]?.int,
|
||||||
streams: extractStreams(from: content),
|
streams: extractStreams(from: content),
|
||||||
|
Loading…
Reference in New Issue
Block a user