Class: Onebox::Engine::YoutubeOnebox
Instance Attribute Summary
#cache, #timeout, #url
Instance Method Summary
collapse
#raw
engines, included, #initialize, #placeholder_html
Instance Method Details
#append_params(html) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/onebox/engine/youtube_onebox.rb', line 13
def append_params(html)
result = html.dup
result.gsub! /(src="[^"]+)/, '\1&wmode=opaque'
if url =~ /t=(\d+)/
result.gsub! /(src="[^"]+)/, '\1&start=' + Regexp.last_match[1]
end
result
end
|
#rewrite_agnostic(html) ⇒ Object
22
23
24
|
# File 'lib/onebox/engine/youtube_onebox.rb', line 22
def rewrite_agnostic(html)
html.gsub(/https?:\/\//, '//')
end
|
#to_html ⇒ Object
9
10
11
|
# File 'lib/onebox/engine/youtube_onebox.rb', line 9
def to_html
rewrite_agnostic(append_params(raw[:html]))
end
|