feat(tracker-adapters): add TBDev adapter and DocsPedia registry entry - #8
Merged
Conversation
TBDev (tbdev.org) is the classic PHP tracker codebase and exposes no API, so stats are scraped from the logged-in /userdetails.php page. Auth is by session cookie rather than username/password, and that is forced rather than chosen: TBDev's login form carries a CAPTCHA, so the login-and- collect-Set-Cookie flow the TorrentLeech adapter uses cannot work. The cookies are long-lived, so capturing them once from a browser is the practical way in. The uid is derived from whichever cookie name ends in `uid`, since the prefix is site-specific (DocsPedia uses doccook_uid, stock TBDev uses uid). Byte units get their own parser. TBDev's mksize() divides by 1024 at every step but labels the result kB/MB/GB/TB, so a TBDev "1.00 GB" is one GiB. Routing that through parseBytes unchanged would read it against the decimal table and under-report by ~7% at GB and ~10% at TB - and parseBytes has no lowercase "kB" entry at all, so the form TBDev actually emits would have thrown. hitAndRuns is null, not 0: stock TBDev has no hit-and-run accounting, and 0 would assert a clean record the tracker cannot vouch for. Verified end-to-end against a live DocsPedia account: HTTP 200, username, class and karma parsed correctly.
Knip Code AnalysisFound 9 total issues
View details
Use |
DocsPedia (`docspedia`) — Warnings (9)
Allowed content categories: See |
|
🚫 Security audit failed Critical Failures
Warnings
Passed (36/38)
Summary: 36/38 checks passed See |
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.
Adds
platformType: "tbdev"plus a DocsPedia registry entry.Why a scraper
TBDev is the classic PHP tracker codebase with no API. Fingerprinted from the live site rather than assumed:
X-Powered-By: PHP/7.4.33,/login.php, andPowered by TBDevin the footer (XBT tracker backend).Cookie auth is forced, not chosen
TBDev's login form carries a CAPTCHA, so the login-and-collect-
Set-Cookieflow the TorrentLeech adapter uses cannot work. The session cookies are long-lived, so capturing them once from a browser is the practical way in.The uid is derived from whichever cookie name ends in
uid— the prefix is site-specific (doccook_uidon DocsPedia,uidon stock TBDev). The match is anchored (/(^|_)uid$/) so it does not grab neighbouring cookies likedoccook_hashv.Byte units are binary despite decimal labels
TBDev's
mksize()divides by 1024 at every step but labels the resultkB/MB/GB/TB, so a TBDev1.00 GBis one GiB. Routing that throughparseBytesunchanged would read it against the decimal table and under-report by ~7% at GB and ~10% at TB.parseBytesis also case-sensitive with nokBentry, so the form TBDev actually emits would have thrown outright.hitAndRuns is null, not 0
Stock TBDev has no hit-and-run accounting — there is no counter on the page.
0would assert a clean record the tracker cannot vouch for.Verification
16 unit tests against a fixture trimmed from a real
/userdetails.phpresponse, plus an end-to-end run against a live account: HTTP 200, username / class / karma parsed correctly, byte fields zero (new account, nothing seeded yet).The GB-is-really-GiB mapping is reasoned from TBDev's source rather than measured, since every byte field on the test account is currently
0.00 kB— worth re-checking once real transfer numbers exist.