Skip to content

fix(audioteka): search returns no results after markup change - #28

Open
PawelHaracz wants to merge 1 commit into
Vito0912:mainfrom
PawelHaracz:fix/audioteka-search-selector
Open

fix(audioteka): search returns no results after markup change#28
PawelHaracz wants to merge 1 commit into
Vito0912:mainfrom
PawelHaracz:fix/audioteka-search-selector

Conversation

@PawelHaracz

Copy link
Copy Markdown

Problem

Every Audioteka search returns {"matches":[]}, HTTP 200, no error in the logs:

GET /audioteka/lang:pl/search?title=wiedzmin&author=sapkowski
{"matches":[]}

Cause is in parseSearchResults:

const $books = $('.adtk-item.teaser_teaser__FDajW')

Audioteka dropped the adtk-item class from the result list items. The selector requires both classes, so it matches nothing. In the live HTML the item is now just:

<li class="teaser_teaser__FDajW"><a class="teaser_link__fxVFQ" href="/pl/audiobook/krew-elfow-tom-1/">

adtk-item does not appear anywhere on the page. All the inner CSS-module hashes still match.

Fix

Match on the CSS-module class prefix rather than the full hashed name, for the result item and for the fields inside it. A frontend rebuild that only changes the hash suffix no longer breaks the parser.

Verification

Against live HTML from https://audioteka.com/pl/szukaj/?phrase=wiedzmin:

  • 28 results parsed (0 before the change)
  • detail page still yields cover, narrator, duration, publisher, description, genres and series:
{
  "title": "Krew elfów. Tom 1",
  "authors": ["Andrzej Sapkowski"],
  "url": "https://audioteka.com/pl/audiobook/krew-elfow-tom-1/",
  "cover": "https://atkcdn.audioteka.com/cc/c8/krew-elfow-tom-1/947.jpg",
  "narrator": "zespół lektorów",
  "duration": 388,
  "publisher": "SuperNOWA",
  "genres": ["Fantasy", "Fantastyka"],
  "series": ["Bestsellery", "Wiedźmin"],
  "language": "polish"
}

prettier --check and tsc --noEmit both pass. Only the pl market was checked against live HTML; the selectors are shared across all markets, so the other locales should benefit the same way.

Note, not fixed here

On the search page the cover <img> sits inside <noscript>, which parse5 treats as raw text with scripting enabled, so match.cover stays empty. It is harmless today because parseBookDetails reads the cover from the detail page. Happy to address it separately if you want covers available without the detail fetch.

🤖 Generated with Claude Code

@Vito0912

Vito0912 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Thanks! Please alter/remove the AI noise comments before a review.

These are comments made by AI agents, but such comment should never be in the code, but in a PR. In the future it is irrelevant that this tag changed and how it was before. This can be checked in the git history

Audioteka removed the `adtk-item` class from result list items. The search
selector required it alongside the CSS-module class, so it matched nothing and
every search returned an empty result set.

Match on the CSS-module class prefix instead of the full hashed name, for the
result item and the fields inside it. A frontend rebuild that only changes the
hash suffix no longer breaks the parser.

Verified against live HTML from https://audioteka.com/pl/szukaj/?phrase=wiedzmin:
28 results parsed, and the detail page still yields cover, narrator, duration,
publisher, description, genres and series.
@PawelHaracz
PawelHaracz force-pushed the fix/audioteka-search-selector branch from 46e46ec to 360714e Compare August 10, 2026 11:11
@PawelHaracz

Copy link
Copy Markdown
Author

@Vito0912 removed, thx for reviewing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants