]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/websites/yikers.rb
Replaced the Yikers algorithm with a simpler one (that actually works).
[dead/whatever-dl.git] / src / websites / yikers.rb
index bb90e3b8730d8a2177594ce3f9a30aba8cd9ade3..8cf407aa4d4ec18083cb2f7f99dfd4ada7227e20 100644 (file)
@@ -29,18 +29,18 @@ class Yikers < Website
 
   
   def get_video_url()
-    # First we download the page. Each page contains a flash parameter
-    # called 'xml' which contains the relative path to the video's XML file.
-    # We download their XML file (passing it the video id as a side effect),
-    # and that contains the URL of the video file we want.
-    page_data = get_page_data(@url)
-    xml_path = self.parse_xml_path(page_data)
-
-    # The XML path parameter doesn't contain a host name.
-    xml_url = "http://#{self.server}#{xml_path}"
-    xml_data = get_page_data(xml_url)
+    # The video URL is usually just a fixed location, with the file
+    # name from the page URL slightly modified. For example,
+    #
+    #   http://www.yikers.com/video_the_best_rapper_in_the_world.html
+    #
+    # gets mapped to,
+    #
+    #   http://cdn.yikers.com/flv/flash8/yikers_the_best_rapper_in_the_world.flv
+    #
+    file_name = get_video_filename().sub('video_', 'yikers_')
     
-    video_url = parse_video_url(xml_data)
+    video_url = "http://cdn.yikers.com/flv/flash8/#{file_name}"
 
     return video_url
   end
@@ -61,24 +61,5 @@ class Yikers < Website
     
     return (filename + '.flv')
   end
-  
-  protected;
-
-  def parse_video_url(data)
-    video_url_regex = /http:\/\/(cdn\.)?yikers\.com\/([[:alnum:]_\/]+)\.flv/
-    matches = video_url_regex.match(data)
-    video_url = matches[0] if not matches.nil?
-    
-    return video_url
-  end
-
-  
-  def parse_xml_path(data)
-    xml_path_regex = /addVariable\(\'xml\', \'(.*?)\'\)/
-    matches = xml_path_regex.match(data)
-    xml_path = matches[1] if not (matches.nil? || matches.length < 2)
-    
-    return xml_path
-  end
     
 end