Class: Anstaendig::DreiSatAgent
- Inherits:
-
AbstractAgent
- Object
- AbstractAgent
- Anstaendig::DreiSatAgent
- Defined in:
- lib/anstaendig/agents/3sat.rb
Overview
Agent for anstaendig to download videos from the 3sat media center.
Instance Attribute Summary
Attributes inherited from AbstractAgent
Instance Method Summary collapse
-
#initialize(uri, quality) ⇒ DreiSatAgent
constructor
A new instance of DreiSatAgent.
Methods inherited from AbstractAgent
#recode, #rip, #run, #userAgent
Constructor Details
#initialize(uri, quality) ⇒ DreiSatAgent
Returns a new instance of DreiSatAgent.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/anstaendig/agents/3sat.rb', line 6 def initialize( uri, quality ) require( 'nokogiri' ) require( 'open-uri' ) require( 'iconv' ) uri.query += '&mode=play' doc = Nokogiri::HTML( open( uri.to_s ) ) title = doc.xpath( '//title' ).inner_html title = title.gsub!( '3sat.Mediathek - Video: ', '' ) + '.wmv' asx = doc.xpath( '//embed[@id="Player2"]' ).attr( 'data' ) asx = Nokogiri::HTML( open( asx ) ) @filename = Iconv.conv( 'utf8', 'latin1', title ) @url = asx.xpath( '//ref' ).attr( 'href' ) end |