X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fwhatever-dl.git;a=blobdiff_plain;f=src%2Fwebsites%2Fyikers.rb;h=8cf407aa4d4ec18083cb2f7f99dfd4ada7227e20;hp=bb90e3b8730d8a2177594ce3f9a30aba8cd9ade3;hb=5185d100c0406dab1f9013e5b0e86289558225e9;hpb=85a93745e73d0dda38b450074b54475f74671577 diff --git a/src/websites/yikers.rb b/src/websites/yikers.rb index bb90e3b..8cf407a 100644 --- a/src/websites/yikers.rb +++ b/src/websites/yikers.rb @@ -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