Merge pull request #1783 from Wevah/ios-candidate

Updates for latest RSParser
This commit is contained in:
Brent Simmons 2020-02-08 16:25:12 -08:00 committed by GitHub
commit f1e01e06fc
4 changed files with 13 additions and 12 deletions

View File

@ -29,16 +29,14 @@ class HTMLFeedFinder {
}
}
if let bodyLinks = RSHTMLLinkParser.htmlLinks(with: parserData) {
let bodyLinks = RSHTMLLinkParser.htmlLinks(with: parserData)
for oneBodyLink in bodyLinks {
if linkMightBeFeed(oneBodyLink) {
let normalizedURL = oneBodyLink.urlString.normalizedURL
if linkMightBeFeed(oneBodyLink), let normalizedURL = oneBodyLink.urlString?.normalizedURL {
let oneFeedSpecifier = FeedSpecifier(title: oneBodyLink.text, urlString: normalizedURL, source: .HTMLLink)
addFeedSpecifier(oneFeedSpecifier)
}
}
}
}
}

View File

@ -49,20 +49,20 @@ struct FaviconURLFinder {
// If the favicon has an explicit type, check that for an ignored type; otherwise, check the file extension.
HTMLMetadataDownloader.downloadMetadata(for: homePageURL) { (htmlMetadata) in
let faviconURLs = htmlMetadata?.favicons.filter({ (favicon) -> Bool in
let faviconURLs = htmlMetadata?.favicons.compactMap({ (favicon) -> String? in
if let type = favicon.type {
if ignoredMimeTypes.contains(type) {
return false
return nil
}
}
else {
if let urlString = favicon.urlString, let url = URL(string: urlString), ignoredExtensions.contains(url.pathExtension) {
return false
return nil
}
}
return true
}).compactMap { $0.urlString }
return favicon.urlString
})
completion(faviconURLs)
}

View File

@ -12,8 +12,9 @@ import RSParser
extension RSHTMLMetadata {
func largestOpenGraphImageURL() -> String? {
let openGraphImages = openGraphProperties.images
guard let openGraphImages = openGraphProperties?.images, !openGraphImages.isEmpty else {
guard !openGraphImages.isEmpty else {
return nil
}
@ -47,7 +48,9 @@ extension RSHTMLMetadata {
func largestAppleTouchIcon() -> String? {
guard let icons = appleTouchIcons, !icons.isEmpty else {
let icons = appleTouchIcons
guard !icons.isEmpty else {
return nil
}

@ -1 +1 @@
Subproject commit 840877988917cf3dbc56b8a0c6e33ddd7aa66479
Subproject commit 47ba87875fbd026dccc2c4d4382a98cb4a1f1fbc