X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fwebsites%2Fliveleak.rb;fp=src%2Fwebsites%2Fliveleak.rb;h=0000000000000000000000000000000000000000;hb=6de408333ceb0d142f8fa0fef2571228e89c8fc1;hp=7016c04c3e3ceb4355aa18c96ab8b320aec21d47;hpb=8e886df259246365023322b78f58e4037cb536a4;p=dead%2Fwhatever-dl.git diff --git a/src/websites/liveleak.rb b/src/websites/liveleak.rb deleted file mode 100644 index 7016c04..0000000 --- a/src/websites/liveleak.rb +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright Michael Orlitzky -# -# http://michael.orlitzky.com/ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# http://www.fsf.org/licensing/licenses/gpl.html -# - -require 'src/website' - -class Liveleak < Website - - VALID_LIVELEAK_URL_REGEX = /^(http:\/\/)?(www\.)?liveleak\.com\/view\?i=.+$/ - - def self.owns_url?(url) - return url =~ VALID_LIVELEAK_URL_REGEX - end - - - def get_video_url() - page_data = self.get_page_data(@url) - embed_tag = parse_embed_tag(page_data) - playlist_data = self.get_page_data(playlist_url(embed_tag)) - - return parse_location_from_playlist(playlist_data) - end - - - protected; - - def parse_embed_tag(page_data) - embed_tag_regex = /file_embed_tag%3D([[:alnum:]]+)%/ - matches = embed_tag_regex.match(page_data) - - if matches.nil? or matches.length < 2 - return StandardError.new("Couldn't parse the video's embed_tag.") - end - - return matches[1] - end - - - def playlist_url(embed_tag) - return "http://www.liveleak.com/playlist_new.php?file_embed_tag=#{embed_tag}" - end - - - def parse_location_from_playlist(xml_data) - file_path_regex = /(.*?)<\/location>/ - matches = file_path_regex.match(xml_data) - - if matches.nil? - raise StandardError.new("Couldn't parse the tag from the playlist XML file.") - end - - return matches[1] - end - -end