class Onebox::Engine::YoukuOnebox

Public Instance Methods

to_html() click to toggle source
# File lib/onebox/engine/youku_onebox.rb, line 22
      def to_html
        <<~HTML
          <iframe
            src="https://player.youku.com/embed/#{video_id}"
            width="640"
            height="430"
            frameborder='0'
            allowfullscreen
          ></iframe>
        HTML
      end
video_id() click to toggle source

Try to get the video ID. Works for URLs of the form:

# File lib/onebox/engine/youku_onebox.rb, line 15
def video_id
  match = uri.path.match(/\/v_show\/id_([a-zA-Z0-9_=\-]+)(\.html)?.*/)
  match && match[1]
rescue
  nil
end