Skip to content

Commit

Permalink
Adapt to HN HTML changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weiran committed Nov 14, 2022
1 parent f21f6a4 commit 0b3e4f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Shared Frameworks/HackersKit/HtmlParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum HtmlParser {
let post = try self.post(from: postElements, type: type)
post.text = self.postText(from: tableElement)
return [post]
} else if tableElement.hasClass("itemlist") {
} else {
// post list
let titleElements = try tableElement.select("tr.athing")
let posts = try titleElements.compactMap { titleElement -> Post? in
Expand Down Expand Up @@ -79,7 +79,7 @@ enum HtmlParser {
let document = try SwiftSoup.parse(html)

guard let parentTable = try document
.select("table.itemlist, table.fatitem")
.select("table#hnmain tr:nth-of-type(3) table")
.first() else {
throw Exception.Error(type: .SelectorParseException, Message: "Couldn't find post element")
}
Expand Down

0 comments on commit 0b3e4f0

Please sign in to comment.