Class: AccessPage
- Inherits:
-
ServiceCall
- Object
- ServiceCall
- AccessPage
- Defined in:
- lib/etvnet_seek/core/access_page.rb
Constant Summary collapse
Instance Attribute Summary
Attributes inherited from ServiceCall
Instance Method Summary collapse
-
#initialize ⇒ AccessPage
constructor
A new instance of AccessPage.
- #request_media_info(media_file, cookie) ⇒ Object
Methods inherited from ServiceCall
Constructor Details
#initialize ⇒ AccessPage
Returns a new instance of AccessPage.
10 11 12 |
# File 'lib/etvnet_seek/core/access_page.rb', line 10 def initialize super(ACCESS_URL) end |
Instance Method Details
#request_media_info(media_file, cookie) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/etvnet_seek/core/access_page.rb', line 14 def request_media_info media_file, params = { 'bitrate' => '2', 'view' => 'submit'} if true params['high_quality'] = "" end headers = { 'Cookie' => , 'X-Requested-With' => 'XMLHttpRequest' } response = post(params, headers, url + "#{media_file}/") # MediaInfo.new Nokogiri::HTML(response.body).css("ref").at(0).attributes["href"].text json = JSON.parse(response.body) if response.kind_of? Net::HTTPOK MediaInfo.new json["url"] else raise "Problem getting url: #{response.class.name}: #{json['msg']} " end end |