Skip to content

Add Nexstar free networks and guides - #117

Open
pizza-191 wants to merge 5 commits into
kineticman:developmentfrom
pizza-191:nexstar-free-networks
Open

pizza-191 wants to merge 5 commits into
kineticman:developmentfrom
pizza-191:nexstar-free-networks

Conversation

@pizza-191

Copy link
Copy Markdown

This adds WGN+, KTLA+, and PIX11+. There are a lot more Nexstar owned channels that likely follow the same pattern but I started with these .

@kineticman

Copy link
Copy Markdown
Owner

Thanks for the update, the Plus-specific guides are a good change. Before merging:

  1. KTLA+ and PIX11+ still 404 for me. The livestreams keys belong to other stream IDs. The Nexstar key in newsnation.py with each page's main player ID worked for all three (up to 720p).
  2. WGN+ lists the biweekly "Adelante, Chicago / People to People" encore every Friday.
  3. KTLA+ has no weekend guide.
  4. Please keep the Lura error code in the failure message (without the URL).
  5. One station's guide failing shouldn't block the others.
  6. Please retarget to development and update the README.

@kineticman

Copy link
Copy Markdown
Owner

I pushed a commit to this branch, so please pull before doing more work.

  • KTLA+ and PIX11+ now play. All three use the Nexstar key from newsnation.py with each page's main player ID. WGN+ now tops out at 720p instead of 1080p.
  • A failed stream lookup now reports the HTTP status and Lura error code.
  • One station's failed guide no longer blocks the others.
  • Updated the Free Networks docstring and README.

Still open: retargeting to development. The biweekly WGN+ entry and KTLA+ weekends can be a follow-up.

@kineticman
kineticman changed the base branch from main to development December 4, 2026 20:36
ssimpson89 and others added 3 commits December 4, 2026 15:51
KTLA+ and PIX11+ returned 404: the keys under 'livestreams' belong to other stream IDs. Use the Nexstar key NewsNation already uses with each page's main player ID (WGN+ now tops out at 720p).

Report the HTTP status and Lura error code when no stream comes back, and let one station's failed guide leave the others updating. Add the stations to the Free Networks docstring and README.

Checked live: all three return a master and variant playlist; a failed KTLA guide still updates the other two; a bad key reports Lura code 101.
@pizza-191
pizza-191 force-pushed the nexstar-free-networks branch from 6f1a910 to 08bd078 Compare December 4, 2026 22:02
@pizza-191

Copy link
Copy Markdown
Author

Nice, It should be rebased

Ranges like '11-1p', '10-12a' and '9-12p' borrowed the end's am/pm for the start, so '11-1p' became 11pm-1pm and wrapped into a 14-hour block, overlapping other shows in the EPG.

Add _range_minutes(), shared by _time_ranges and _recurring_slots. When the start has no am/pm it tries both meridiems and keeps the shorter duration. Verified on extracted functions: 11-1p -> 11:00-13:00, 10-12a -> 22:00-00:00, 9-12p -> 09:00-12:00, 8-9p -> 20:00-21:00, 11p-1a -> 23:00-01:00.
@kineticman

Copy link
Copy Markdown
Owner

Thanks for the PR. Review found one real bug, which I fixed and pushed to this branch in 951d1ab.

Fixed: time ranges with no am/pm on the start
Ranges like 11-1p, 10-12a and 9-12p borrowed the end's am/pm for the start, so 11-1p became 11pm-1pm and wrapped into a 14-hour block that overlapped other shows. _time_ranges and _recurring_slots now share a _range_minutes() helper that tries both meridiems and keeps the shorter duration.

Remaining nits (not blocking, yours to take or leave)

  1. resolve() assumes the WordPress content field is a dict and doesn't wrap HTTP errors the way the Lura call does. Guard with isinstance(content, dict) and raise a clean RuntimeError on RequestException.
  2. _schedule_date only rolls the year forward when a date is more than 30 days past, so dates around New Year can land in the wrong year (e.g. "preempted Dec 30" seen on Jan 2). Pick the year (last, this or next) closest to today.
  3. If one station's guide fetch fails and others succeed, programs() returns only the successful rows. Worth confirming the caller replaces programs per channel, not per network, so the failed station keeps its stored guide.
  4. Only one blank line before class Nexstar, and the module imports the private _ACCESS_KEY from .newsnation. Moving the key into _common would remove that coupling.

resolve(): wrap the WordPress lookup in the same RequestException handling as the Lura call (reporting only the exception type, no URL), and guard a non-dict 'content' field.

_schedule_date: choose the year (last, this or next) nearest today instead of only rolling forward past 30 days, so 'preempted December 30' read on Jan 2 is last month and 'January 2' read on Dec 30 is next month.

Move the Anvato access key into _common as ANVATO_ACCESS_KEY so nexstar.py no longer imports a private name from newsnation.py, and fix the blank-line spacing before class Nexstar.

Verified _schedule_date on extracted code across year boundaries and a leap day.
@kineticman

Copy link
Copy Markdown
Owner

Pushed 1480eff, which fixes the remaining nits from my earlier comment, except one that turned out not to be a bug.

  • resolve(): the WordPress lookup now has the same error handling as the Lura call (only the exception type is reported, not the URL), and a non-dict content field is guarded.
  • _schedule_date: picks the year (last, this or next) nearest today, so dates around New Year resolve correctly.
  • The Anvato key moved to _common.ANVATO_ACCESS_KEY, so nexstar.py no longer imports a private name from newsnation.py. Also fixed the blank-line spacing before class Nexstar.
  • Partial guide failure (nit 3): not a bug. _upsert_programs deletes stored programs only for channels that have incoming rows, so a station whose fetch fails keeps its stored guide. No change needed.

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.

3 participants