Skip to content

fix: parse Russian "N сезон (A-B из C)" as season N with an episode range - #70

Merged
Viren070 merged 1 commit into
AIOStreams:mainfrom
a1d4r:fix/russian-season-number-before-word
Oct 6, 2026
Merged

Viren070 merged 1 commit into
AIOStreams:mainfrom
a1d4r:fix/russian-season-number-before-word

Conversation

@a1d4r

@a1d4r a1d4r commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #66 / #67. Another common Russian season-pack notation (RuTor, Bitru, MegaPeer) puts the season number before the word "сезон" and the episode range in brackets with "из" ("of"), without the word "серии". The season-range handler grabbed that bracketed episode range as seasons.

Title Before After
Клан Сопрано 2 сезон (1-13 из 13) / The Sopranos (2000) WEB-DL S [1..13], title Клан Сопрано 2 S [2], E [1..13], title Клан Сопрано
Друзья 5 сезон (1-24 из 24) / Friends (1998) BDRip S [1..24] S [5], E [1..24]
Симпсоны 10-й сезон (1-23 из 23) / The Simpsons S [1..23] S [10], E [1..23]
Игра престолов 1-8 сезон (1-73 из 73) / Game of Thrones S [1..73], E [1..8] S [1..8], E [1..73]
Игра престолов 1-7 сезон: (1-67 из 67) / Game of Thrones S [1..67], E [1..7] S [1..7], E [1..67]

Change

One line in src/handlers.ts: the season-range handler now skips the Russian [Сс]езон[иы]? branch when the word is preceded by a standalone one- or two-digit number (optionally with -й):

(?<!(?:^|[^a-z\d])\d{1,2}(?:-?й)?[. _]?)[Сс]езон[иы]?

The season is then picked up by the existing N сезон / A-B сезон handlers and the range by the episode-range handler. Digits that end another token (S02 сезон, 1923 Сезон 1-2, 90210 Сезон 1-5) don't block it. The other alternatives (seasons, sezon, temporadas, stagioni) are untouched.

I first tried a lookahead on из after the range instead, but it broke Сезон 1-8 из 8 and Сезоны 1-3 из 8, where the range really is seasons.

Tests

Added 9 tests to seasons.test.ts: the cases above, plus regression checks for (1-8 сезон: 1-73 серии из 73), Сезон 2 (1-10 из 10), Сезоны 1-3 из 11 and 1923 Сезон 1-2. The full suite passes (38 suites, 1329 tests).

I also compared main and this branch on 5,742 real titles from Russian trackers (15 TV series and 25 anime): 151 titles changed, all from "seasons 1..N" to "season N, episodes 1..M" (plus the season number leaving the title). No changes to year, resolution or languages, and no regressions.

Context

In AIOStreams, a request for S03E02 returned packs like 2 сезон (1-13 из 13) for every episode of seasons 1–13, and a complete-series pack 1-8 сезон (1-73 из 73) disappeared from episode 9 onwards.

…ange

The season-range handler matched the word "сезон" and then took the
episode range in the following brackets as seasons when the season
number came before the word: "2 сезон (1-13 из 13)" gave seasons 1-13,
"1-8 сезон (1-73 из 73)" gave seasons 1-73 and episodes 1-8.

Skip the handler when "сезон" is preceded by a standalone one- or
two-digit number (optionally with "-й"), so the "N сезон" and
"A-B сезон" handlers pick up the season and the range is parsed as
episodes. Digits that end another token ("S02", "1923", "90210") do not
block it. "Сезон 1-8", "Сезоны 1-3 из 8" and
"Сезон: 2 / Серии: 1-10 из 10" are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Viren070
Viren070 merged commit 46bc6fe into AIOStreams:main Oct 6, 2026
3 checks passed
@a1d4r
a1d4r deleted the fix/russian-season-number-before-word branch October 6, 2026 18:50
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
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