Skip to content

Instantly share code, notes, and snippets.

@julesfern
Last active December 14, 2015 15:19
Show Gist options
  • Save julesfern/5107225 to your computer and use it in GitHub Desktop.
Save julesfern/5107225 to your computer and use it in GitHub Desktop.
Simple script for getting embed codes from vj-core
Dash:videojuicer.com danski$ ~/utilities/vj_embed_codes.rb seed=wavecastpro id=1
Requesting from http://api.videojuicer.com/oembed?seed_name=wavecastpro&url=http://api.videojuicer.com/presentations/1.html&maxwidth=600&maxheight=600&format=json
video, http:
<video width="600" height="338" controls poster="http://thumbnails.videojuicer.com/wavecastpro/presentations/1.jpg?maxwidth=600&maxheight=338"> <source type="application/vnd.apple.mpegurl" src="http://wavecastpro-primary.videojuicer.com:1935/wavecast/_definst_/testing/playlist.m3u8"> </video>
video, https:
<video width="600" height="338" controls poster="http://thumbnails.videojuicer.com/wavecastpro/presentations/1.jpg?maxwidth=600&maxheight=338"> <source type="application/vnd.apple.mpegurl" src="http://wavecastpro-primary.videojuicer.com:1935/wavecast/_definst_/testing/playlist.m3u8"> </video>
player-v5, http:
<iframe width="600" height="338" frameborder="0" src="http://player.videojuicer.com/v5.html?heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&seed_name=wavecastpro&presentation_id=1" name="videojuicer_wavecastpro-1_1362653370" id="" allowfullscreen mozallowfullscreen webkitallowfullscreen> </iframe>
player-v5, https:
<iframe width="600" height="338" frameborder="0" src="http://player.videojuicer.com/v5.html?heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&seed_name=wavecastpro&presentation_id=1" name="videojuicer_wavecastpro-1_1362653370" id="" allowfullscreen mozallowfullscreen webkitallowfullscreen> </iframe>
player-v4, http:
<object width="600" height="338" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="videojuicer_seed_wavecastpro_presentation_1"> <param name="movie" value="http://player.videojuicer.com/player.swf" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="FlashVars" value="heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&amp;seed_name=wavecastpro&amp;presentation_id=1" /> <param name="name" value="videojuicer_seed_wavecastpro_presentation_1" /> <param name="wmode" value="transparent" /> <embed src="http://player.videojuicer.com/player.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" FlashVars="heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&amp;seed_name=wavecastpro&amp;presentation_id=1" width="600" height="338" name="videojuicer_seed_wavecastpro_presentation_1" wmode="transparent" /> </object>
player-v4, https:
<object width="600" height="338" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="videojuicer_seed_wavecastpro_presentation_1"> <param name="movie" value="http://player.videojuicer.com/player.swf" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="FlashVars" value="heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&amp;seed_name=wavecastpro&amp;presentation_id=1" /> <param name="name" value="videojuicer_seed_wavecastpro_presentation_1" /> <param name="wmode" value="transparent" /> <embed src="http://player.videojuicer.com/player.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" FlashVars="heritage_id=e657e70e-54d2-4371-9f4d-b36c3410da90%3A&amp;seed_name=wavecastpro&amp;presentation_id=1" width="600" height="338" name="videojuicer_seed_wavecastpro_presentation_1" wmode="transparent" /> </object>
Dash:videojuicer.com danski$
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'json'
args = {}
ARGV.each do |a|
k,v = a.split("=")
args[k] = v
end
args = {
"maxwidth" => 600,
"maxheight" => 600,
"env" => "production"
}.merge(args)
unless args["seed"] and args["id"]
puts <<-HELP
usage: vj_embed_codes.rb seed=EXAMPLE id=PRESENTATION_ID [env=production maxwidth=600 maxheight=600]
HELP
exit
end
hosts = {
"production" => "api.videojuicer.com",
"staging" =>"api.staging.videojuicer.com"
}
endpoint_url = "http://#{hosts[args["env"]]}/oembed"
resource_url = "http://#{hosts[args["env"]]}/presentations/#{args["id"]}.html"
request_url = "#{endpoint_url}?seed_name=#{args["seed"]}&url=#{resource_url}&maxwidth=#{args["maxwidth"]}&maxheight=#{args["maxheight"]}&format=json"
puts "Requesting from #{request_url}"
response = JSON.parse(open(request_url).read)
embed_codes = response["embeds"]["html"]
embed_codes.each_pair do |k,v|
code, secure_code = v["http"], v["https"]
puts "#{k}, http:"
puts <<-CODE
#{code}
CODE
puts ""
puts "#{k}, https:"
puts <<-CODE
#{code}
CODE
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment