We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents edd127e + 56cbcd1 commit 132362eCopy full SHA for 132362e
lib/yt/annotations/end_screen.rb
@@ -7,14 +7,22 @@ class EndScreen < Base
7
# @param [Hash] json the Hash representation of the XML data returned by
8
# YouTube for each end screen of a video.
9
def initialize(json = {})
10
- @text = json['title']['runs'][0]['text']
+ @text = text_in json
11
@starts_at = json['startMs'].to_i / 1000.0
12
@ends_at = ends_at_in json
13
@link = to_link json
14
end
15
16
private
17
18
+ def text_in(json)
19
+ if json['title']['runs'].nil?
20
+ json['title']['simpleText']
21
+ else
22
+ json['title']['runs'][0]['text']
23
+ end
24
25
+
26
def ends_at_in(json)
27
json['endMs'].to_i / 1000.0
28
0 commit comments