Rejigger the find-feed scoring to handle bitsplitting.org — we were getting the podcast feed just because it had “RSS” in the title. But we want the blog feed to get the best score.

This commit is contained in:
Brent Simmons 2017-10-21 16:23:51 -07:00
parent da1b7a6c7b
commit c237aed5b8
1 changed files with 1 additions and 10 deletions

View File

@ -63,7 +63,7 @@ public struct FeedSpecifier: Hashable {
}
var currentHighScore = 0
var currentBestFeed = feedSpecifiers.anyObject()
var currentBestFeed: FeedSpecifier? = nil
for oneFeedSpecifier in feedSpecifiers {
let oneScore = oneFeedSpecifier.score
@ -96,9 +96,6 @@ private extension FeedSpecifier {
if urlString.rs_caseInsensitiveContains("rss") {
score = score + 5
}
if urlString.rs_caseInsensitiveContains("atom") {
score = score - 5
}
if urlString.hasSuffix("/feed/") {
score = score + 5
}
@ -110,12 +107,6 @@ private extension FeedSpecifier {
if title.rs_caseInsensitiveContains("comments") {
score = score - 10
}
if title.rs_caseInsensitiveContains("rss") {
score = score + 10
}
if title.rs_caseInsensitiveContains("atom") {
score = score - 5
}
}
return score