mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-26 17:05:19 +01:00
Parse story image and tags
This commit is contained in:
parent
1d3073c593
commit
0479bbd9f5
@ -22,11 +22,16 @@ struct NewsBlurStoriesResponse: Decodable {
|
||||
let url: String?
|
||||
let authorName: String?
|
||||
let contentHTML: String?
|
||||
var imageURL: String? {
|
||||
return imageURLs?.first
|
||||
}
|
||||
var tags: [String]?
|
||||
var datePublished: Date? {
|
||||
let interval = (publishedTimestamp as NSString).doubleValue
|
||||
return Date(timeIntervalSince1970: interval)
|
||||
}
|
||||
|
||||
private var imageURLs: [String]?
|
||||
private var publishedTimestamp: String
|
||||
}
|
||||
}
|
||||
@ -45,6 +50,8 @@ extension NewsBlurStoriesResponse.Story {
|
||||
case url = "story_permalink"
|
||||
case authorName = "story_authors"
|
||||
case contentHTML = "story_content"
|
||||
case imageURLs = "image_urls"
|
||||
case tags = "story_tags"
|
||||
case publishedTimestamp = "story_timestamp"
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ extension NewsBlurAccountDelegate {
|
||||
|
||||
let parsedItems: [ParsedItem] = stories.map { story in
|
||||
let author = Set([ParsedAuthor(name: story.authorName, url: nil, avatarURL: nil, emailAddress: nil)])
|
||||
return ParsedItem(syncServiceID: story.storyID, uniqueID: String(story.storyID), feedURL: String(story.feedID), url: story.url, externalURL: nil, title: story.title, contentHTML: story.contentHTML, contentText: nil, summary: nil, imageURL: nil, bannerImageURL: nil, datePublished: story.datePublished, dateModified: nil, authors: author, tags: nil, attachments: nil)
|
||||
return ParsedItem(syncServiceID: story.storyID, uniqueID: String(story.storyID), feedURL: String(story.feedID), url: story.url, externalURL: nil, title: story.title, contentHTML: story.contentHTML, contentText: nil, summary: nil, imageURL: story.imageURL, bannerImageURL: nil, datePublished: story.datePublished, dateModified: nil, authors: author, tags: Set(story.tags ?? []), attachments: nil)
|
||||
}
|
||||
|
||||
return Set(parsedItems)
|
||||
|
Loading…
Reference in New Issue
Block a user