Skip to content

v0.1.2

Choose a tag to compare

@jehrr jehrr released this 29 Sep 23:40
· 21 commits to main since this release
48f1704

Behaviour changes. --query now filters: it was sent without the
search type the library needs and was ignored, so every keyword run
returned the whole region. A keyword that matches nothing is exit 4 (the
library's own total: 0), not exit 5. diff_runs.py refuses two runs
that asked a different keyword, region set, ad type or window.

Fixed

  • A recovered page is not a blocked one. _fetch_with_policy kept a
    "refusal seen" flag that a later successful attempt never cleared, so a
    retry that got the page still reported it blocked. Measured live on
    2026-09-29 (pyppeteer, @nasa): one empty HTTP 200, then the profile,
    then partial / stop_reason: blocked with pages_failed: []. And the
    HTTP -> browser switch spent a --retries attempt, so with --retries 0
    a browser started and was never asked for the page. Both fixed in all
    three engines, with a check that drives the real function.
  • --query was ignored. search_body() sent query_type: ""; the
    library's UI sends "1", and only then does the keyword filter.
    Measured 2026-09-29, DE, same window: 19,000,309 / 19,000,308 (keyword /
    nonsense) before, 416 / 0 after, in all three engines. The canary now
    runs a positive and a negative keyword control.
  • "Nothing matched" read as an API error. The library's answer is
    {"code": 0, "total": 0, "has_more": false} with no data key, and the
    classifier called that an error, so the fixed keyword search would have
    made every empty result exit 5. It is exit 4.
  • The envelope is judged before any row. A non-zero code is the API
    refusing even when data is [] (it read as "no ads"); data that is
    not a list is a parse error; records none of which carries an id
    raise instead of reading as an empty region.
  • A failed region was listed as having no ads. failed holds region
    numbers and was compared against a region name.
  • diff_runs.py compares only runs that asked the same question. The
    sidecar now records query, query_type, ad_type and window_days.

diff_runs.py compared almost nothing. Its TRACKED_FIELDS were
tiktok-profile-scraper's account columns, 26 of which Advertisement
does not have, so a diff of two runs reported "0 changed" whenever only
an ad's run dates, review status or audience changed. It now tracks this
repo's own columns and prints each run's share of the library's
per-region total. smoke_test.py pins every tracked name against the
dataclass and checks that a changed column is actually reported.

A copied .env.example set TIKTOK_URL=nasa, a TikTok handle, which
is not a region. It is now DE.

  • Donor prose removed from the shared core. output_writer.py,
    diff_runs.py, the engines, page_flow.py, smoke_test.py,
    .github/ci_checks.py and the Dockerfile carried text from the repos
    this core was copied from — YouTube comment threads, --sort top,
    reply threads, job listings, "the business", --mode comments --out software-engineer — describing those sites as if they were this one.
    Rewritten from this repo's own README, code and fixtures, or deleted
    where there was no measured equivalent. Explicit sibling provenance
    ("measured on tiktok-profile-scraper's route", "a sibling repo
    (youtube-scraper) had…") is kept and now says whose it is.

  • output_writer.py's docstring described --mode profile and account
    statistics; page_flow.py, the engines and smoke_test.py described a
    profile page, an account, video_unavailable and the embed window. All
    now describe the Ad Library (or are gone).

  • The engines' _rotate_if_per_page said nothing one fetch receives feeds
    the next; on this route the search_id cursor does, and it now says so.

  • smoke_test.py's run_meta test data is an ads run on
    library.tiktok.com rather than a profile run on @nasa.

  • .github/ci_checks.py no longer exempts an avatar_id column this repo
    does not have from the credential scan.

  • captcha_solver.py's docstring pointed at a "No DataDome solver" section
    that does not exist in this repo (it came with the copied core). Removed.

  • The Scraper API engine failed on every --wait-text / --wait-element /
    --wait-state call, and was billed for it.
    It sent waitFor as a
    JSON-encoded string; measured 2026-09-23 the live API answers that with
    HTTP 422 "params.waitFor must be an object" and still charges $0.0005,
    while the same request with an object is answered 200. It is now sent as
    an object. (The target status was already read from http_code; the new
    regression check pins that too, driving the real fetch_html with
    requests.post stubbed.)

  • --wait-state networkidle is refused by the Scraper API (HTTP 422
    "params.waitFor.state must be one of: load, domcontentloaded", still
    billed — measured 2026-09-23 on a sibling repo with the object-shaped
    waitFor). The choice is removed.