Skip to content

Handle missing duration for video premieres#459

Open
marcoroth wants to merge 1 commit into
claudiob:masterfrom
marcoroth:fix-duration-for-premiere
Open

Handle missing duration for video premieres#459
marcoroth wants to merge 1 commit into
claudiob:masterfrom
marcoroth:fix-duration-for-premiere

Conversation

@marcoroth

@marcoroth marcoroth commented Jun 11, 2026

Copy link
Copy Markdown

The YouTube API omits contentDetails.duration while a video is an ongoing premiere. The default value 0 was then passed to to_seconds, which expects an ISO 8601 string, raising undefined method 'match' for an instance of Integer:

duration error: NoMethodError: undefined method 'match' for an instance of Integer
  /Users/marcoroth/.local/share/mise/installs/ruby/4.0.1/lib/ruby/gems/4.0.0/gems/yt-0.34.1/lib/yt/models/content_detail.rb:62:in 'Yt::Models::ContentDetail#to_seconds'
  /Users/marcoroth/.local/share/mise/installs/ruby/4.0.1/lib/ruby/gems/4.0.0/gems/yt-0.34.1/lib/yt/models/content_detail.rb:18:in 'block in <class:ContentDetail>'

This pull request fixes this so that Video#duration now returns 0 and Video#length "00:00:00" in that case.

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.

1 participant