Skip to content

Commit

Permalink
Catch HTML parsing errors when fetching feed
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Feb 17, 2024
1 parent 263bafd commit fbf9499
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ class FeedFetcher(private val httpClient: HttpClient, private val feedParser: Fe
}

private fun fetchFeedLinkFromHtmlIfExists(htmlContent: String, originalUrl: String): String? {
val document = Ksoup.parse(htmlContent)
val document =
try {
Ksoup.parse(htmlContent)
} catch (t: Throwable) {
return null
}

val linkElement =
document.getElementsByTag(TAG_LINK).firstOrNull {
val linkType = it.attr(ATTR_TYPE)
Expand Down

0 comments on commit fbf9499

Please sign in to comment.