mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 16:51:19 +01:00
29 lines
596 B
Swift
29 lines
596 B
Swift
//
|
|
// FaviconURLFinder.swift
|
|
// Evergreen
|
|
//
|
|
// Created by Brent Simmons on 11/20/17.
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import RSParser
|
|
|
|
// The favicon URL may be specified in the head section of the home page.
|
|
|
|
struct FaviconURLFinder {
|
|
|
|
static func findFaviconURL(_ homePageURL: String, _ callback: @escaping (String?) -> Void) {
|
|
|
|
guard let _ = URL(string: homePageURL) else {
|
|
callback(nil)
|
|
return
|
|
}
|
|
|
|
HTMLMetadataDownloader.downloadMetadata(for: homePageURL) { (htmlMetadata) in
|
|
callback(htmlMetadata?.faviconLink)
|
|
}
|
|
}
|
|
}
|
|
|