Repository navigation
Replace jsoup with ksoup for HTML parsing - #57
Merged
Merged
Conversation
Swap the jsoup dependency for ksoup (com.fleeksoft.ksoup), a Kotlin Multiplatform port of jsoup, and remove jsoup entirely. - Version catalog: drop jsoup 1.22.2, add ksoup 0.2.6 - Switch the dependency in :core:network:rutracker and :proxy - Migrate imports (org.jsoup.* -> com.fleeksoft.ksoup.*) and the Jsoup.parse entry point to Ksoup.parse across the rutracker parsers - Adapt the two API differences: Tag.name() and TextNode.getWholeText() ksoup's Elements API preserves jsoup's null-on-empty semantics for first()/last(), so parsing behaviour is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EPxhiZbmURTJvhRzAHcpGu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces jsoup with ksoup (
com.fleeksoft.ksoup), a Kotlin Multiplatform port of jsoup, and removes jsoup entirely from the project.Changes
gradle/libs.versions.toml): dropjsoup 1.22.2, addksoup 0.2.6.libs.jsoup→libs.ksoupin:core:network:rutrackerand:proxy.:core:network:rutrackerparsers, 12 files):org.jsoup.*→com.fleeksoft.ksoup.*imports.Jsoup.parse(...)→Ksoup.parse(...).ParsePostUseCase:Tag.name(property) →Tag.name()(function)TextNode.wholeText(property) →TextNode.getWholeText()(function)The rest of the jsoup API (
select,selectFirst,first/last,attr,text,hasClass,children,childNodes,remove, …) is identical in ksoup, so the parsing logic is otherwise untouched.Behaviour compatibility
The main risk in this swap is
Elements.first()/last(): the parsers rely on jsoup's null-on-empty semantics (rather than Kotlin'sList.first(), which throws). Verified that ksoup'sNodesdeclares its ownfirst()/last()members returning a nullableElement?(bytecode showsreturn nullwhen empty), so behaviour is preserved.Local verification
./gradlew :core:network:rutracker:compileKotlin— ✅ compiles clean (the jsoup jspecify nullability warnings are also gone, since ksoup is pure Kotlin).Ksoup.parse, CSS selection,first()-null-on-empty,ParseTorrentStatusUseCase, andParsePostUseCase(text/<br>/bold →getWholeText()+tag().name()paths) — all passed.grepconfirms zero remainingjsoupreferences.🤖 Generated with Claude Code
https://claude.ai/code/session_01EPxhiZbmURTJvhRzAHcpGu
Generated by Claude Code