Repository navigation
Conversation
Introduce RuTrackerParser — a pure (html -> DTO) seam with no network — and its ksoup-backed RuTrackerHtmlParser implementation, which keeps the focused Parse*UseCase objects as internal building blocks it delegates to. The page-parsing use cases (search, category, forum, topic, comments, torrent, profile, favorites) and the page-state checks now go through the parser instead of parsing inline, so the whole parsing layer sits behind one swappable interface. The public NetworkApi contract is unchanged. Add characterization tests over real rutracker HTML fixtures for the guest-viewable parsers (forum, category, topic, comments, profile, plus the not-found / unauthorized states). Step 1 of decoupling parsing rules from app releases: a config-driven RuTrackerParser can later be swapped in via RuTrackerApiFactory. 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.
Step 1 of decoupling parsing from app releases
Goal of the whole effort: be able to change rutracker parsing rules without shipping a new release, by eventually swapping in a config-driven parser. This PR builds the seam that makes that swap a one-line change, and pins current behaviour with tests on real pages.
What this PR does
RuTrackerParserinterface — a pureString html → DTO / Booleancontract, no network, no IO. It's the single place that holds all markup/text knowledge.RuTrackerHtmlParser(ksoup) implements it, keeping the focusedParse*UseCaseobjects as the internal building blocks it delegates to (ParseTopicPageUseCase,ParseCommentsPageUseCase,ParseTorrentUseCase,ParsePostUseCase,ParseTorrentStatusUseCase).Get*UseCase/Utilsmoved into the parser.RuTrackerApiFactoryconstructs the parser and injects it — this is the line Step 3 will swap.NetworkApicontract is unchanged → blast radius stays inside:core:network:rutracker.Tests (TDD on real HTML)
Characterization tests run against real saved rutracker pages in
src/test/resources/fixtures/—:core:network:rutracker:testis green (9/9). Covered:parseForum,parseCategoryPage,parseTorrent,parseTopicPage,parseCommentsPage(incl. quote/spoiler/image post content),parseProfile, and thetopic-exists/forum-exists/is-authorized/is-torrent-topicstates.Known gap — authenticated fixtures needed
The
search/favorites/main_authorizedcaptures came back as login stubs (the session cookie wasn't authenticated — nologged-in-usernameanywhere), so these parsers aren't test-covered yet:parseSearchPage,parseFavorites(+ page count),parseCurrentUserId,isAuthorized == true#tor-status-respstatus +#tor-size-humnsize)The interface methods exist and are implemented; tests will be added once authenticated fixtures are re-captured. The auth/login/form-token/captcha/action-result callers (
WithFormTokenUseCase,LoginUseCase, add/remove favorite, add comment) are also still inline — they'll be routed through the parser in a follow-up increment.Next
RuTrackerParser(also TDD against these same fixtures).RuTrackerApiFactory.🤖 Generated with Claude Code
https://claude.ai/code/session_01EPxhiZbmURTJvhRzAHcpGu
Generated by Claude Code