lib/hlspider/spider.rb
def dive(urls = [])
      playlists = []
            
      responses = download(urls) 
                   
      responses.each do |response|
        playlist = Playlist.new(response.body, response.url)
              
        if playlist.valid?
          if playlist.variable_playlist?
            playlists << dive(playlist.playlists)
          else
            playlists << playlist
          end 
        else
          raise InvalidPlaylist, "#{playlist.source} was an invalid playlist."
        end  
      end
      
      playlists.flatten  
    end
# Internal: Download playlists from Array urls.
#
#
# Examples
#
#   dive(["http://host.tld/video1/playlist_1.m3u8", "http://host.tld/video1/playlist_2.m3u8"])
#   # => [#<HLSpider::Playlist:0x10ca9bef8>, #<HLSpider::Playlist:0x10ca9bef9>]
#
# Returns Array of Playlists.
# Raises HLSpider::Spider::InvalidPlaylist if an invalid playlist is downloaded.
Download playlists from Array urls.
Examples



Returns Array of Playlists.
Raises HLSpider::Spider::InvalidPlaylist if an invalid playlist is downloaded.
Download playlists from Array urls . Examples Returns Array of Playlists . Raises HLSpider :: Spider :: InvalidPlaylist if an invalid playlist is downloaded .
def dive(urls = [])
      playlists = []
      responses = download(urls) 
      responses.each do |response|
        playlist = Playlist.new(response.body, response.url)
        if playlist.valid?
          if playlist.variable_playlist?
            playlists << dive(playlist.playlists)
          else
            playlists << playlist
          end 
        else
          raise InvalidPlaylist, "#{playlist.source} was an invalid playlist."
        end  
      end
      playlists.flatten  
    end
def dive ( urls = [ ] ) playlists = [ ] responses = download ( urls ) responses . each do | response | playlist = Playlist . new ( response . body , response . url ) if playlist . valid? if playlist . variable_playlist? playlists << dive ( playlist . playlists ) else playlists << playlist end else raise InvalidPlaylist , "#{playlist.source} was an invalid playlist." end end playlists . flatten end
Internal: Download playlists from Array urls.
Internal : Download playlists from Array urls .
urls