Repository navigation
Conversation
…raising `parse_timestamp` checked `raw.isdigit()` before `int(raw)`, but isdigit is True for digits int() rejects, such as "²". A YouTube URL with `t=²` therefore made `parse_youtube_url` raise a bare ValueError instead of a TimedMediaError, so callers that catch the module's own errors (e.g. reading's `youtube_video_id`, which catches ReadingError) let it escape. The check is now `isdecimal()`, exactly the characters int() accepts: "²" falls through to the h/m/s pattern and parses as 0 like any other unreadable value, while decimal digits from other scripts (e.g. "١٢") still parse as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XAE-A-Xii
force-pushed
the
fix/youtube-timestamp-unicode-digits
branch
from
December 5, 2026 12:15
29c1843 to
9c938d3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A YouTube URL whose
tvalue contains a superscript digit madeparse_youtube_urlraise a bareValueError.parse_timestamp(deeptutor/video_learning/service.py) checkedraw.isdigit()before callingint(raw), butisdigit()is also True for charactersint()rejects:Callers only expect this module's own errors. For example,
reading/ingestion.youtube_video_idcatchesReadingError, so theValueErrorescapes instead of the timestamp being ignored.The check is now
isdecimal(), which is exactly the set of charactersint()accepts."²"falls through to theh/m/spattern and parses as0, like any other unreadable value ("1.5"→ 0). Decimal digits from other scripts, such as Arabic-Indic"١٢", still parse as 12, which an ASCII-only[0-9]+check would have broken.Related Issues
Module(s) Affected
agentsapiconfigcoreknowledgeloggingservicestoolsutilsweb(Frontend)docs(Documentation)scriptstestsvideo_learningChecklist
dev(notmain— see the base-branch selector above).pre-commit run --all-filesand fixed any issues.Additional Notes
Tests in
tests/video_learning/test_service.py:test_parse_supported_youtube_urlsgains at=²row (start 0).test_parse_timestamp_ignores_digit_like_characters_int_rejectscovers"82","1m2s","²","³⁴","١٢"and"1.5".Before the fix the three superscript cases fail. A check limited to ASCII
[0-9]+fails the"١٢"case, so the test pins theisdecimal()choice.Out of scope for this PR (one module per PR):
deeptutor/reading/ingestion.py:651has its own copy ofparse_timestampwith the sameisdigit()→int()pattern, andreading/references.py:171andtextbook_struct/page_headers.pyhave similar checks. I'm happy to follow up on those separately if you'd like.pre-commit run --fileson both changed files passes every hook.--all-filesfailsmypyondevitself inservices/embedding/adapters/volcengine.py, from #1015, which this PR doesn't touch.🤖 Generated with Claude Code