mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-05 13:27:45 +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 url: String?
|
||||||
let authorName: String?
|
let authorName: String?
|
||||||
let contentHTML: String?
|
let contentHTML: String?
|
||||||
|
var imageURL: String? {
|
||||||
|
return imageURLs?.first
|
||||||
|
}
|
||||||
|
var tags: [String]?
|
||||||
var datePublished: Date? {
|
var datePublished: Date? {
|
||||||
let interval = (publishedTimestamp as NSString).doubleValue
|
let interval = (publishedTimestamp as NSString).doubleValue
|
||||||
return Date(timeIntervalSince1970: interval)
|
return Date(timeIntervalSince1970: interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var imageURLs: [String]?
|
||||||
private var publishedTimestamp: String
|
private var publishedTimestamp: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,6 +50,8 @@ extension NewsBlurStoriesResponse.Story {
|
|||||||
case url = "story_permalink"
|
case url = "story_permalink"
|
||||||
case authorName = "story_authors"
|
case authorName = "story_authors"
|
||||||
case contentHTML = "story_content"
|
case contentHTML = "story_content"
|
||||||
|
case imageURLs = "image_urls"
|
||||||
|
case tags = "story_tags"
|
||||||
case publishedTimestamp = "story_timestamp"
|
case publishedTimestamp = "story_timestamp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ extension NewsBlurAccountDelegate {
|
|||||||
|
|
||||||
let parsedItems: [ParsedItem] = stories.map { story in
|
let parsedItems: [ParsedItem] = stories.map { story in
|
||||||
let author = Set([ParsedAuthor(name: story.authorName, url: nil, avatarURL: nil, emailAddress: nil)])
|
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)
|
return Set(parsedItems)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user