Skip to content

Drop implausible season/episode numbers in ziggogo.tv - #3225

Open
quepasaquepasa wants to merge 2 commits into
iptv-org:masterfrom
quepasaquepasa:fix-ziggogo-bogus-episode-numbers
Open

Drop implausible season/episode numbers in ziggogo.tv#3225
quepasaquepasa wants to merge 2 commits into
iptv-org:masterfrom
quepasaquepasa:fix-ziggogo-bogus-episode-numbers

Conversation

@quepasaquepasa

Copy link
Copy Markdown
Contributor

Fixes #2977

Events without real season/episode data get internal ids leaked into seasonNumber/episodeNumber by the upstream API. Sampled live data today:

title seasonNumber episodeNumber
UVandaag 93850000 513104564
Tekst TV 5110000 513104549
Route C 5070000 2026073018 (encodes today's date)

The ziggogo.tv frontend hides these values; this PR does the same by dropping season outside (0, 1000) and episode outside (0, 100000). The gap between real data (seasons ≤ ~100, episodes ≤ ~10k for daily shows) and the garbage (≥ 5×10⁶) is several orders of magnitude, so the thresholds have wide safety margins on both sides — addressing the concern raised in the issue thread about long-running shows with 4-digit episode numbers, which are preserved.

Verified against today's live guide for NPO 1: 52 programmes parsed, real values kept (S9 E10, S2 E11), bogus ids now omitted.

@freearhey freearhey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failed:

npm test --- ziggogo.tv

> test
> cross-env TZ=Pacific/Nauru npx jest --runInBand ziggogo.tv

 FAIL  sites/ziggogo.tv/ziggogo.tv.test.js
  ✓ can generate valid url (7 ms)
  ✕ can parse response (18 ms)
  ✓ can handle empty guide (1 ms)

  ● can parse response

    expect(received).toMatchObject(expected)

    - Expected  - 2
    + Received  + 2

    @@ -2,11 +2,11 @@
        "category": Array [
          "Consumentenprogramma's",
          "Shoppen",
        ],
        "description": "Homeshoppingprogramma waarin de kijker via de telefoon allerlei producten kan aanschaffen.",
    -   "episode": 492767862,
    -   "season": 78610000,
    +   "episode": null,
    +   "season": null,
        "start": "2026-05-30T04:00:00.000Z",
        "stop": "2026-05-30T11:03:00.000Z",
        "title": "Telvero",
      }

      61 |
      62 |   expect(result.length).toBe(21)
    > 63 |   expect(result[2]).toMatchObject({
         |                     ^
      64 |     start: '2026-05-30T04:00:00.000Z',
      65 |     stop: '2026-05-30T11:03:00.000Z',
      66 |     title: 'Telvero',

      at Object.toMatchObject (sites/ziggogo.tv/ziggogo.tv.test.js:63:21)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 2 passed, 3 total
Snapshots:   0 total
Time:        0.766 s
Ran all test suites matching ziggogo.tv.

@quepasaquepasa

Copy link
Copy Markdown
Contributor Author

Thanks — fixed in 4de574e. The stored fixture pins the current behaviour, so changing it necessarily broke that assertion; I should have updated the test in the same commit.

What's useful is that the fixture happens to contain both cases, which makes it a good check on the thresholds:

  • result[2] (Telvero) carried season 78610000, episode 492767862 — the internal ids this PR drops. Now expects null.
  • result[19] (Pawn Stars) carries season 17, episode 24 — real numbering, untouched by the change and still asserted as before.

So the same fixture now demonstrates that only the implausible values are removed. npm test -- ziggogo.tv passes (3/3).

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

High number Episode-num Ziggogo.tv for programmes without episode data

3 participants