]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Added the ability to download videos from http://www.yikers.com/.
authormjo <mjo@mjo.(none)>
Fri, 31 Oct 2008 17:09:08 +0000 (13:09 -0400)
committermjo <mjo@mjo.(none)>
Fri, 31 Oct 2008 17:09:08 +0000 (13:09 -0400)
Created tests for the new Yikers class.
Added a method to the Website class returning the host portion of its URL.

src/website.rb
src/websites/yikers.rb [new file with mode: 0644]
test/fixtures/yikers/video_college_cafeteria_strip_off.html [new file with mode: 0644]
test/fixtures/yikers/video_college_cafeteria_strip_off.xml [new file with mode: 0644]
test/test_suite.rb
test/yikers_test.rb [new file with mode: 0644]

index 96290dee3de99ac7d00f34e14298110be82455a0..b5a501f9db8184d403d93ee1c13a34900b10506d 100644 (file)
 # http://www.fsf.org/licensing/licenses/gpl.html
 #
 
+# Necessary in a lot of subclasses; plus, we need it
+# to parse the server name out of our URL.
+require 'uri'
+
 # This class keeps track of all its subclasses
 # We use this to loop through every "website" in an
 # attempt to determine to which site a URL belongs.
@@ -37,6 +41,13 @@ class Website
     @subclasses << subclass
   end
 
+
+  def server
+    # Get the HTTP server portion of our URI
+    uri = URI.parse(@url)
+    return uri.host
+  end
+
   
   public;
 
diff --git a/src/websites/yikers.rb b/src/websites/yikers.rb
new file mode 100644 (file)
index 0000000..b602f3a
--- /dev/null
@@ -0,0 +1,101 @@
+#
+# 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'
+
+# Needed to download the page, which is in turn
+# needed because it contains the video URL.
+require 'net/http'
+
+
+class Yikers < Website
+
+  VALID_YIKERS_URL_REGEX = /^(http:\/\/)?(www\.)?yikers\.com\/([[:alnum:]_]+)\.html$/
+  
+  def self.owns_url?(url)
+    return url =~ VALID_YIKERS_URL_REGEX
+  end
+
+  
+  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)
+    
+    video_url = parse_video_url(xml_data)
+
+    return video_url
+  end
+
+
+  def get_video_filename()
+    # Default to whatever comes after the final frontslash
+    # in the main URL.
+    filename = @url.split('/').pop()
+    
+    # These page URLs are actually descriptive, so we can use
+    # the file name of the HTML page as our video file name.
+    filename_regex = /\/([[:alnum:]_]+)\.html$/
+    matches = filename_regex.match(@url)
+
+    # Overwrite the default if our regex worked.
+    filename = matches[1] if not (matches.nil? || matches.length < 1)
+    
+    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
+  
+  
+  def get_page_data(url)
+    uri = URI.parse(url)
+
+    response = Net::HTTP.start(uri.host, uri.port) do |http|
+      http_path = uri.path
+      http_path += ('?' + uri.query) if not uri.query.nil?
+      http.get(http_path)
+    end
+    
+    return response.body
+  end
+  
+end
diff --git a/test/fixtures/yikers/video_college_cafeteria_strip_off.html b/test/fixtures/yikers/video_college_cafeteria_strip_off.html
new file mode 100644 (file)
index 0000000..6498862
--- /dev/null
@@ -0,0 +1,327 @@
+<html>\r
+<head>\r
+<title>College Cafeteria Strip Off</title>\r
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
+<meta name="keywords" content="cafeteria college strip">\r
+<meta name="description" content="College Cafeteria Strip Off">\r
+<meta name="rating" content="General">\r
+<meta name="revisit-after" content="1 day">\r
+<meta name="distribution" content="global">\r
+<meta name="robots" content="index,follow">\r
+<meta http-equiv="Content-Style-Type" content="text/css">\r
+<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> \r
+<script src="/ajax/prototype.js" type="text/javascript"></script>\r
+<script src="/ajax/scriptaculous.js" type="text/javascript"></script>\r
+<script src="/ajax/effects.js" type="text/javascript"></script>\r
+<link href="http://www.yikers.com/stylesheet.css" rel="stylesheet" type="text/css">\r
+<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.yikers.com/rss/rss.xml">\r
+<script language="JavaScript1.2">\r
+\r
+       function borderit(which,color){\r
+       //if IE 4+ or NS 6+\r
+       if (document.all||document.getElementById){\r
+       which.style.borderColor=color\r
+       }\r
+       }\r
+\r
+if (parent.frames.length > 0) {\r
+   parent.location.href = self.document.location\r
+}\r
+\r
+</script>\r
+       <script type="text/javascript" src="/flash/js/navigation_api.js"></script>\r
+       <script type="text/javascript" src="/flash/js/swfobject.js"></script>\r
+</head>\r
+<body>\r
+<table width="990" height="25" border="0" cellpadding="0" cellspacing="0" align="center">\r
+       <tr>\r
+               <td align="right">\r
+                       <a href="http://traffic.liveuniversenetwork.com/links/1781/" class="white" target="_blank">SlideShows</a> | <a href="http://traffic.liveuniversenetwork.com/links/1782/" class="white" target="_blank">Upload</a> | <a href="http://traffic.liveuniversenetwork.com/links/1783/" class="white" target="_blank">Groups</a> | <a href="http://traffic.liveuniversenetwork.com/links/1784/" class="white" target="_blank">Live Shows</a>\r
+               </td>\r
+       </tr>\r
+</table>\r
+<table width="990" height="117" border="0" cellpadding="0" cellspacing="0" align="center">\r
+       <tr>\r
+               <td>\r
+                       <a href="/index.html" title="Funny Videos, Pictures, Jokes, and Fun Humor"><img src="/images/logo.jpg" width="252" height="117" alt="Funny Videos, Pictures, Jokes, and Fun Humor"></a></td>\r
+               <td style="background-image: url('/images/rightbg.jpg')" width="738" height="117" align="center">\r
+                               \r
+                       <iframe src="/ads/728.php" name="myframe" width="750" height="105" frameborder="0" allowtransparency="true"></iframe>\r
+               </td>\r
+       </tr>\r
+</table>\r
+\r
+<table cellspacing="0" cellpadding="0" width="990" align="center" class="navheader">\r
+       <tr>\r
+               <td width="10">&nbsp;</td>\r
+               <td class="tabbg"><a href="/index.html" class="white" title="Funny Videos, Pictures, Jokes, and Fun Humor">Home</a></td>\r
+               <td class="tabbg"><a href="/funny_videos.html" class="white" title="Funny Videos">Videos</a></td>\r
+               <td class="tabbg"><a href="/funny_jokes.html" class="white" title="Funny Jokes">Jokes</a></td>\r
+               <td class="tabbg"><a href="/fun_games.html" class="white" title="Fun Games">Games</a></td>\r
+               <td class="tabbg"><a href="/picture_gallery_funny_pictures.html" class="white" title="Funny Pictures">Pictures</a></td> \r
+               <td class="tabbg"><a href="/funny_soundboards.html" class="white" title="Celebrity Soundboards">Soundboards</a></td>\r
+               <td class="tabbg"><a href="/forums/" class="white">Forums</a></td>\r
+               <td width="200" align="right" style="padding-top: 3px"><form action="/search.html" method="post"><input type="text" name="term" class="inpsearch" size="16" onfocus="this.value='';" value=" search media">&nbsp;&nbsp;<input type="image" src="http://www.yikers.com/images/buttons/btn_go.gif" align="absmiddle">&nbsp;</form></td>\r
+               <td width="10">&nbsp;</td>\r
+\r
+       </tr>\r
+</table>\r
+\r
+<table cellspacing="0" cellpadding="0" width="990" align="center" style="background-color: #081d38; padding-top: 5px">\r
+<tr>\r
+       <td width="10">&nbsp;</td>\r
+       <td width="10" class="bodyboxes">&nbsp;</td>\r
+       <td valign="top" class="bodyboxes">\r
+\r
+       <h3>College Cafeteria Strip Off</h3>\r
+                                                     \r
+       <!-- flash player goes here -->\r
+       <table width="100%" border="0" cellspacing="0" cellpadding="0">\r
+               <tr>\r
+                       <td align="center">\r
+                       \r
+                                                       \r
+                               <div id="scriptflashcontent">\r
+                                       <script type="text/javascript">\r
+                                               document.write('<strong>You need to upgrade your Flash Player</strong><br/>');\r
+                                               document.write('This site requires Flash Player 8.0 Release 0 or higher.<br/>');\r
+                                               document.write('Your Flash Player does not meet this minimum.<br/>');\r
+                                               document.write('<a href=http://www.macromedia.com/go/getflash/>Please get the latest Flash Player here.</a>');\r
+                                       </script>\r
+                               </div>\r
+                               <script type="text/javascript">\r
+                                       // <![CDATA[\r
+                                       var so = new SWFObject("/flash/FLVPlayer.swf", "FLVPlayer", "445", "363", "8.0.0");\r
+                                       so.addParam('allowScriptAccess', 'sameDomain');\r
+                                       so.addParam('allowFullScreen', 'true');\r
+                                       so.addParam('quality', 'best');\r
+                                       so.addParam('bgcolor', '#000000'); // This is only relavent if wmode does not equal transparent.\r
+                                       so.addParam('wmode', 'window'); // window opaque transparent\r
+                                       so.addVariable('autoStart', '1');\r
+                                       so.addVariable('xml', '/flash/play_flash_xml.php?cid=11798');\r
+                                       so.write("scriptflashcontent");\r
+                                       // ]]>\r
+                               </script>\r
+                               <noscript>\r
+                                       <!--\r
+                                               The object data attribute and param movie value use the same value. What we are doing is passing\r
+                                               five query string vars to a SWF that does nothing but verify the installed version of Flash since\r
+                                               we can use JavaScript because it is either not installed or disabled. The vars are as follows:\r
+                                               \r
+                                               target_movie = path to the real SWF we want to show\r
+                                               major_version = The minimum major number of the Flash Player the user needs to have.\r
+                                               minor_version = The minimum minor number of the Flash Player the user needs to have.\r
+                                               release = The minimum release number of the Flash Player the user needs to have.\r
+                                               query_str = The query string we wish to pass to the target movie. The entire string must be URL\r
+                                                       encoded even if parts of it are already URL encoded. Double encoding is fine in this case.\r
+                                       -->\r
+                                       <object id="FLVPlayer" type="application/x-shockwave-flash"\r
+                                        data="/flash/flashdetect.swf?target_movie=/flash/FLVPlayer.swf&major_version=8&minor_version=0&release=0&query_str=autoStart%3D1%26xml%3D%2Fflash%2Fplayvideo_xml.php%3Fcid%3D11798"\r
+                                        width="445" height="363">\r
+                                               <param name="movie" value="/flash/flashdetect.swf?target_movie=/flash/FLVPlayer.swf&major_version=8&minor_version=0&release=0&query_str=autoStart%3D1%26xml%3D%2Fflash%2Fplayvideo_xml.php%3Fcid%3D11798" />\r
+                                               <param name="allowScriptAccess" value="sameDomain" />\r
+                                               <param name="allowFullScreen" value="true" />\r
+                                               <param name="quality" value="best" />\r
+                                               <param name="bgcolor" value="#000000" />\r
+                                               <param name="wmode" value="window" />\r
+                                               <p><strong>You need to upgrade your Flash Player</strong><br/>\r
+                                               This site requires Flash Player 8.0 Release 0 or higher.<br/>\r
+                                               Your Flash Player does not meet this minimum.<br/>\r
+                                               <a href=http://www.macromedia.com/go/getflash/>Please get the latest Flash Player here.</a></p>\r
+                                       </object>\r
+                               </noscript>\r
+                                                                                                                       </td>\r
+               </tr>\r
+       </table>\r
+       <!-- end flash player -->\r
+       <table border=0 cellspacing=0 cellpadding=3 width=450 align=center><tr><td width=110><a href="/previous_11798.html"><< <B>Previous</B></a></td><td align=center>Trouble watching? <a href="/contact.html">Contact us</a></td><td align=right width=110><a href="/next_11798.html"><B>Next</B> >></a></td></tr></table>\r
+       \r
+\r
+\r
+       \r
+       <a name="embed"></a>\r
+       <table border=0 cellspacing=0 cellpadding=5 width="450" align="center" style="padding-top: 5px; margin-bottom: 5px; border: 1px solid #000000\">\r
+               </table>\r
+       \r
+                       <h2>Similar Media</h2>\r
+               <table border=0 cellspacing=0 cellpadding=0 align=center width=450 align=center><tr>\r
+               <tr><td class="desc" align="left"><a href="/video_sexy_drunk_girl_crashes_dirtbike.html" class="nounder" title="Sexy drunk girl c..."><img src="http://cdn.yikers.com/thumbs/yikers_sexy_drunk_girl_crashes_dirtbike_15.jpg" class="videopodthin2" vspace=3 onMouseover="borderit(this,'#d34a00')" onMouseout="borderit(this,'#c0c0c0')" alt="Sexy drunk girl c..."></a></td><td class="desc" align="center"><a href="/video_espn_profanity.html" class="nounder" title="Espn profanity"><img src="http://cdn.yikers.com/thumbs/yikers_espn_profanity_06.jpg" class="videopodthin2" vspace=3 onMouseover="borderit(this,'#d34a00')" onMouseout="borderit(this,'#c0c0c0')" alt="Espn profanity"></a></td><td class="desc" align="center"><a href="/video_drunks_take_out_cop_cars.html" class="nounder" title="Drunks take out c..."><img src="http://cdn.yikers.com/thumbs/yikers_drunks_take_out_cop_cars_15.jpg" class="videopodthin2" vspace=3 onMouseover="borderit(this,'#d34a00')" onMouseout="borderit(this,'#c0c0c0')" alt="Drunks take out c..."></a></td><td class="desc" align="right"><a href="/video_frisky_sea_otter.html" class="nounder" title="Frisky sea otter"><img src="http://cdn.yikers.com/thumbs/yikers_frisky_sea_otter_20.jpg" class="videopodthin2" vspace=3 onMouseover="borderit(this,'#d34a00')" onMouseout="borderit(this,'#c0c0c0')" alt="Frisky sea otter"></a></td></tr></tr></table>\r
+                               <br><br>\r
+               \r
+\r
+       <script language="JavaScript">\r
+       function emoticon(form, field, start)\r
+               {\r
+                       var textarea = document.forms[form].elements[field];\r
+                       if (typeof(textarea.selectionStart) != "undefined")\r
+                       {\r
+                               var text = new Array();\r
+                               text[0] = textarea.value.substr(0, textarea.selectionStart);\r
+                               text[1] = textarea.value.substr(textarea.selectionEnd);\r
+                               caretPos = textarea.selectionEnd+start.length;\r
+                               textarea.value = text[0]+start+text[1];\r
+                               if (textarea.setSelectionRange)\r
+                               {\r
+                                       textarea.focus();\r
+                                       textarea.setSelectionRange(caretPos, caretPos);\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               textarea.focus();\r
+                               theSelection = document.selection.createRange().text;\r
+                               document.selection.createRange().text = start + theSelection;\r
+                               textarea.focus();\r
+                       }\r
+               }\r
+       </script>\r
+\r
+       \r
+       <br>\r
+       <a name="comments"></a>\r
+       \r
+        <!-- comments -->\r
+       <h3>User Comments</h3>\r
+        \r
+\r
+                               <a name="10722"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/4105.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/bosshonkey.html">bosshonkey</a> on May 10, 2007 @ 05:03:26 am</b><p>\r
+                                               and this is our future?  great....wtf are these 'students' learning? 
+Wonder if their parents like paying for them to strip in school. xxxxing
+retards                                                </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 bosshonkey wrote: and this is our future?  great....wtf are these students learning?  Wonder if their parents like paying for them to strip in school. fucking retards[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+                       <a name="10735"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/4742.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/devin.html">devin</a> on May 10, 2007 @ 08:41:43 am</b><p>\r
+                                               I want to go to school there.                                           </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 devin wrote: I want to go to school there.[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+                       <a name="10737"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/3704.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/disbelief.html">disbelief</a> on May 10, 2007 @ 09:20:19 am</b><p>\r
+                                               i agree... some people need to be hit in the face with a brick.                                         </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 disbelief wrote: i agree... some people need to be hit in the face with a brick.[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+                       <a name="10742"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/4105.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/bosshonkey.html">bosshonkey</a> on May 10, 2007 @ 09:49:42 am</b><p>\r
+                                               or two....                                              </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 bosshonkey wrote: or two....[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+                       <a name="10763"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/4749.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/quick flex.html">quick flex</a> on May 10, 2007 @ 03:37:06 pm</b><p>\r
+                                               Yeah, what school is this? I'd also like to enroll.                                             </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 quick flex wrote: Yeah, what school is this? Id also like to enroll.[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+                       <a name="10655"></a><table cellpadding="5" cellspacing="0" border="0" width=100% bgcolor="#133561">\r
+                               <tr>\r
+                                       <!--<td valign="top"><img src="http://www.yikers.com/i/a/4765.jpg" class="photopod" width="50"></td>-->\r
+                                       <td valign="top">\r
+                                               <span class="videodscrp">\r
+                                               <b>Posted by: <a href="/profiles/obscura.html">obscura</a> on May 10, 2007 @ 10:15:41 pm</b><p>\r
+                                               Silkeborg Highschool in Denmark                                         </span><br />\r
+                                               <div align=right><a href="#postnew" onclick="emoticon('comment', 'msg', '[quote]On May 10, 2007 obscura wrote: Silkeborg Highschool in Denmark[/quote]');">Quote</a> | <a href="#postnew">Post New</a></div>\r
+                                       </td>\r
+                               </tr>\r
+                       </table><p>\r
+               \r
+        \r
+\r
+       <a name="end"></a>\r
+       \r
+                               \r
+       <br><a name="postnew"></a><b>Post Comment</b>:<br>\r
+       <p>Want to post a comment? <a href="/register.html">Register</a> for a free account or <a href="/login.html">login</a> to your existing account.<p> \r
+                       \r
+                                       <br><br></td>\r
+                                       <td width="10" class="bodyboxes">&nbsp;</td>\r
+\r
+                                       <td width="160" valign=top class="bodyboxes">\r
+                                                                               \r
+                                               \r
+                                       \r
+                                       <h2>Today's Top Sites</h2><table border=0 cellspacing=0 cellpadding=2 width=100%><tr><td><a href="/out/249/" target="_blank" title="http://www.machovideo.com"  class="nav2" rel=nofollow>Macho Video</a></td></tr><tr><td><a href="/out/1501/" target="_blank" title="http://www.hotlinkspace.com"  class="nav2" rel=nofollow>Hot Video Links</a></td></tr><tr><td><a href="/out/161/" target="_blank" title="http://www.kontraband.com"  class="nav2" rel=nofollow>Kontraband</a></td></tr><tr><td><a href="/out/40/" target="_blank" title="http://www.ownagevideos.com"  class="nav2" rel=nofollow>Ownage Videos</a></td></tr><tr><td><a href="/out/456/" target="_blank" title="http://www.flurl.com/item/How_to_Untangle_Headphones_Using_Mice__u_278896"  class="nav2" rel=nofollow>Flurl Video Search</a></td></tr><tr><td><a href="/out/1314/" target="_blank" title="http://www.dumpalink.com"  class="nav2" rel=nofollow>Funny Crazy Videos</a></td></tr><tr><td><a href="/out/2114/" target="_blank" title="http://popuplace.com"  class="nav2" rel=nofollow>Hot Videos</a></td></tr><tr><td><a href="/out/1463/" target="_blank" title="http://www.mojoflix.com"  class="nav2" rel=nofollow>MojoFlix</a></td></tr><tr><td><a href="/out/374/" target="_blank" title="http://www.uniquepeek.com"  class="nav2" rel=nofollow>Unique Peek</a></td></tr><tr><td><a href="/out/1385/" target="_blank" title="http://www.fightzilla.com"  class="nav2" rel=nofollow>Street Fight Videos</a></td></tr><tr><td><a href="/out/713/" target="_blank" title="http://www.funnyearth.com"  class="nav2" rel=nofollow>Free Online Games</a></td></tr><tr><td><a href="/out/1875/" target="_blank" title="http://www.filecabi.net"  class="nav2" rel=nofollow>FileCabi.net</a></td></tr><tr><td><a href="/out/38/" target="_blank" title="http://www.killsometime.com"  class="nav2" rel=nofollow>Kill Some Time</a></td></tr><tr><td><a href="/out/1556/" target="_blank" title="http://humor.e-favourite.com"  class="nav2" rel=nofollow>Favorite Vids n Pics</a></td></tr><tr><td><a href="/out/551/" target="_blank" title="http://www.nothingtoxic.com"  class="nav2" rel=nofollow>Hot Vids</a></td></tr><tr><td><a href="/http://traffic.liveuniversenetwork.com/links/1903/" title="Play Online Games"  class="nav2" target="_blank">Play Online Games</a></td></tr><tr><td><a href="/http://traffic.liveuniversenetwork.com/links/1925/" title="Whats Your IQ?"  class="nav2" target="_blank">Whats Your IQ?</a></td></tr><tr><td><a href="/trade.html" title="Trade with Us"  class="nav2"><b>Add Your Link</b></a></td></tr><tr><td><a href="/coolsites.html" title="More Cool Sites"  class="nav2"><b>More Cool Sites</b></a></td></tr></table><p>\r
+                                                                               \r
+                                               <iframe src="/ads/160.php" scrolling="No" allowtransparency="true" width="160" height="600" frameborder="0"></iframe>\r
+                                                                               \r
+                                       \r
+                                       <p></td>\r
+\r
+                                       <td width="10" class="bodyboxes">&nbsp;</td>\r
+\r
+                                       <td valign="top" width="300" align=center class="bodyboxes">\r
+                                       \r
+                                       <a href="/register.html"><b>Register for free</b></a> | <a href="/login.html"><B>Login</B></a><p>\r
+\r
+                                                                               \r
+                                               <iframe src="/ads/300.php" scrolling="No" allowtransparency="true" width="300" height="255" frameborder="0"></iframe>\r
+                                                                               <p>\r
+                                       <table border=0 cellspacing=0 cellpadding=0 width=300><tr><td valign=top><table width="100%" border="0" cellspacing="1" cellpadding="1">\r
+<tr><td class=small><strong>Cool Clips</strong></td></tr>\r
+\r
+\r
+<tr><td class=small><a href="http://traffic.liveuniversenetwork.com/links/890/" target="_blank">A cat with two faces.</a></td></tr>\r
+<tr><td class=small><a href="http://traffic.liveuniversenetwork.com/links/958/" target="_blank">Best wedding first dance ever.</a></td></tr>\r
+<tr><td class=small><a href="http://traffic.liveuniversenetwork.com/links/891/" target="_blank">How to get with two girls.</a></td></tr>\r
+<tr><td class=small><a href="http://traffic.liveuniversenetwork.com/links/892/" target="_blank">Student tries to poison teacher.</a></td></tr>\r
+</table>\r
+</td></tr></table>\r
+\r
+                                       <p>\r
+                                       <style>\r
+                                               .lvpromothumb { width: 90px; height: 70px; border: 1px solid #fff; }\r
+                                               .lvpromolink { color: #fff; font-size: 11px; }\r
+                                       </style>\r
+                                       <h2>Must See LIVE Streaming</h2>\r
+                                       <script src="http://traffic.liveuniversenetwork.com/zones.php?mid=21&zoneID=236" language="JavaScript" type="text/javascript"></script>\r
+                                                                                                <style>.pimg { width: 90px; height: 70px; border: 1px solid white; } a.ptext:link, a.ptext:active, a.ptext:visited { color:#000000; font-weight: normal; font-size: 11px; .lutext { font-family: verdana, tahoma, helvetica; font-size: 10px; vertical-align: top; text-align: left; } </style>\r
+                                                                                               <p><h2>More Cool Videos</h2>\r
+                                               <table cellspacing="0" cellpadding="3" align="center" width="100%"><tr><td style="vertical-align: top"><a href="/out/1403/" target="_blank" title="http://www.livevideo.com/" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/31/125031/132269_17s.jpg" width="90" height="70" border=0 class="pimg"></td><td style="vertical-align: top"><a href="/out/31/" target="_blank" title="http://www.ugoto.com" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/34/119134/305984s.jpg" width="90" height="70" border=0 class="pimg"></td><td style="vertical-align: top"><a href="/out/1501/" target="_blank" title="http://www.hotlinkspace.com" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/99/171799/214428_ps.jpg" width="90" height="70" border=0 class="pimg"></td></tr><tr><td style="vertical-align: top"><a href="/out/1510/" target="_blank" title="http://www.justfightvideos.com" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/42/97042/149835_10s.jpg" width="90" height="70" border=0 class="pimg"></td><td style="vertical-align: top"><a href="/out/1157/" target="_blank" title="http://www.smashingames.com" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/93/57993/41040_25s.jpg" width="90" height="70" border=0 class="pimg"></td><td style="vertical-align: top"><a href="/out/161/" target="_blank" title="http://www.kontraband.com" class="ptext" rel=nofollow><img src="http://cdn.livevideo.com/image/97/79697/66966_2s.jpg" width="90" height="70" border=0 class="pimg"></td></tr></table><p>                                                                       \r
+                                                <P><span class=small>Trade traffic? Sign up and start sending traffic. We will send 1:1 back via the random rotation plugs above. The more hits you send the more hits you will get back. <a href="/trade.html">Sign up</a> if you are interested in trading permanent plug.</span>\r
+                                                                               \r
+                                        </td>\r
+                                        <td width="10" class="bodyboxes">&nbsp;</td>\r
+                                        <td width="10">&nbsp;</td>\r
+                               </tr>\r
+                       </table>\r
+      <br />\r
+         <center><a href="/dmca.html">DMCA</a> | <a href="/privacy.html">Privacy</a> | <a href="/tos.html">Terms of Service</a> | <a href="http://www.liveuniverse.com/advertise" target="_blank">Advertise</a> | <a href="/trade.html" target="_blank">Trade Traffic</a> | <a href="/contact.html">Contact</a> | <a href="/forums/">Forums</a> | <a href="/rss/rss.xml">RSS</a><p><a href="http://www.celebrityonvideo.com/" target="_blank" title="Celebrity Videos">Celebrity Videos</a> | <a href="http://www.flurl.com/" target="_blank" title="Video Search Engine">Video Search Engine</a> | <a href="http://www.celeb-gossip-videos.com" target="_blank" title="Celebrity Gossip Videos">Celebrity Gossip Videos</a> | <a href="http://www.celebrity-news-videos.com" target="_blank" title="Celebrity News Videos">Celebrity News Videos</a> | <a href="http://www.hollywood-gossip-videos.com" target="_blank" title="Hollywood Gossip Videos">Hollywood Gossip Videos</a> | <a href="http://www.hollywood-celeb-videos.com" target="_blank" title="Hollywood Celeb Videos">Hollywood Celeb Videos</a> | <a href="http://www.election-2008-videos.com" target="_blank" title="Election 2008 Videos">Election 2008 Videos</a><p><a href="http://www.nba-basketball-videos.com" target="_blank" title="NBA Basketball Videos">NBA Basketball Videos</a> | <a href="http://www.mlb-baseball-videos.com" target="_blank" title="MLB Baseball Videos">MLB Baseball Videos</a> | <a href="http://www.sexy-celeb-videos.com" target="_blank" title="Sexy Celebrity Videos">Sexy Celebrity Videos</a> | <a href="http://www.humor-comedy-videos.com" target="_blank" title="Humor Comedy Videos">Humor Comedy Videos</a><p>Copyright &copy; 2007 Yikers.com.  All Rights Reserved.</center>\r
+\r
+<script language="javascript">\r
+       var ServName = "http://analyze.yikers.com/";\r
+</script>\r
+<script src="http://analyze.yikers.com/__utm.js" type="text/javascript"></script>\r
+\r
+\r
+\r
+</body>\r
+</html>\r
+          \r
diff --git a/test/fixtures/yikers/video_college_cafeteria_strip_off.xml b/test/fixtures/yikers/video_college_cafeteria_strip_off.xml
new file mode 100644 (file)
index 0000000..dd4cf6d
--- /dev/null
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<flvplayer>\r
+       <player_data>\r
+               <autoplay>true</autoplay>\r
+               <skin_url><![CDATA[/flash/yikers_skin_001.swf]]></skin_url>\r
+               <skin2_url></skin2_url>\r
+               <skin3_url></skin3_url>\r
+               <comments><![CDATA[javascript:url_set_anchor('comment')]]></comments>\r
+               <embed></embed>\r
+               <flag></flag>\r
+               <fullscreen><!-- Fullscreen Parameters XML -->\r
+                       <control1>\r
+                               <visible>true</visible>\r
+                               <fullscreen>\r
+                                       <align>bottom</align>\r
+                                       <hidden>false</hidden>\r
+                                       <scale>false</scale>\r
+                               </fullscreen>\r
+                               <normal>\r
+                                       <x>0</x>\r
+                                       <y>0</y>\r
+                               </normal>\r
+                       </control1>\r
+                       <control2>\r
+                               <visible>false</visible>\r
+                               <fullscreen>\r
+                                       <hidden>true</hidden>\r
+                                       <x>10000</x>\r
+                               </fullscreen>\r
+                               <normal>\r
+                                       <x>0</x>\r
+                                       <y>392</y>\r
+                               </normal>\r
+                       </control2>\r
+                       <control3>\r
+                               <visible>false</visible>\r
+                               <fullscreen>\r
+                                       <hidden>true</hidden>\r
+                                       <x>10000</x>\r
+                               </fullscreen>\r
+                               <normal>\r
+                                       <x>28</x>\r
+                                       <y>429</y>\r
+                               </normal>\r
+                       </control3>\r
+                       <video>\r
+                               <fullscreen>\r
+                                       <align>center_x</align>\r
+                                       <y>0</y>\r
+                               </fullscreen>\r
+                               <normal>\r
+                                       <x>0</x>\r
+                                       <y>0</y>\r
+                                       <width>445</width>\r
+                                       <height>334</height>\r
+                               </normal>\r
+                       </video>\r
+               </fullscreen>\r
+               <clickthru><![CDATA[http://www.yikers.com/video_college_cafeteria_strip_off.html]]></clickthru>\r
+               <ad_ids>\r
+                       <siteid_postroll>20</siteid_postroll>\r
+                       <pubid_postroll>45549FE81D8B42E9A688CAF4BD24AA22</pubid_postroll>\r
+                       <siteid_text>20</siteid_text>\r
+                       <pub_id_text>45549FE81D8B42E9A688CAF4BD24AA22</pub_id_text>\r
+                       <siteid_inline>20</siteid_inline>\r
+                       <pubid_inline>45549FE81D8B42E9A688CAF4BD24AA22</pubid_inline>\r
+               </ad_ids>\r
+               <postroll>\r
+                       <url>/flash/lu_postroll_001.swf</url>\r
+                       <thumbs_disabled>false</thumbs_disabled>\r
+               </postroll>\r
+               <tooltip>\r
+                       <style>\r
+                               <title>\r
+                                       <bold>true</bold>\r
+                                       <color>#FFFFFF</color>\r
+                               </title>\r
+                               <description>\r
+                                       <bold>false</bold>\r
+                                       <color>#FFFFFF</color>\r
+                               </description>\r
+                       </style>\r
+               </tooltip>\r
+       </player_data>\r
+       <video_playlist>\r
+               <video order="0">\r
+                       <crypId>11798</crypId>\r
+                       <title><![CDATA[College Cafeteria Strip Off]]></title>\r
+                       <description><![CDATA[Um, nice final project?  I have no idea what's going on here.]]></description>\r
+                       <url><![CDATA[http://www.yikers.com/video_college_cafeteria_strip_off.html]]></url>\r
+                       <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_college_cafeteria_strip_off.html')]]></change_video>\r
+                       <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_college_cafeteria_strip_off_4.jpg]]></thumbnail>\r
+                       <runtime>00:30</runtime>\r
+                       <comments>0</comments>\r
+                       <flv7></flv7>\r
+                       <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flv]]></flv8>\r
+                       <family>on</family>\r
+                       <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11798/')]]></share>\r
+                       <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11798', 'fullscreen')]]></fullscreen>\r
+                       <ad_terms><![CDATA[cafeteria,college,strip]]></ad_terms>\r
+                       <categories><![CDATA[entertainment]]></categories>\r
+               </video>\r
+                                       <video order="1">\r
+                               <crypId>11797</crypId>\r
+                               <title><![CDATA[Conan Loves Heidi Klums Rack]]></title>\r
+                               <description><![CDATA[Well, can you blame him?]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_conan_loves_heidi_klums_rack.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_conan_loves_heidi_klums_rack.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_conan_loves_heidi_klums_rack_1.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_conan_loves_heidi_klums_rack.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11797/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11797', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[conan,heidi,klums,loves,rack]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="2">\r
+                               <crypId>11796</crypId>\r
+                               <title><![CDATA[Street Fighting Out In The Snow]]></title>\r
+                               <description><![CDATA[Bad soundtrack, good fight.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_street_fighting_out_in_the_snow.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_street_fighting_out_in_the_snow.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_street_fighting_out_in_the_snow_4.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_street_fighting_out_in_the_snow.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11796/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11796', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[fighting,snow,street]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="3">\r
+                               <crypId>11795</crypId>\r
+                               <title><![CDATA[Girl Gets Sat On And Pounded]]></title>\r
+                               <description><![CDATA[She's gonna feel that in the morning.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_girl_gets_sat_on_and_pounded.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_girl_gets_sat_on_and_pounded.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_girl_gets_sat_on_and_pounded_1.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_girl_gets_sat_on_and_pounded.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11795/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11795', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[gets,girl,pounded,sat]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="4">\r
+                               <crypId>11794</crypId>\r
+                               <title><![CDATA[White Guys Cant Dunk]]></title>\r
+                               <description><![CDATA[They sure can make asses of themselves though.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_white_guys_cant_dunk.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_white_guys_cant_dunk.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_white_guys_cant_dunk_3.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_white_guys_cant_dunk.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11794/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11794', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[cant,dunk,guys]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="5">\r
+                               <crypId>11793</crypId>\r
+                               <title><![CDATA[Why Little Kids Shouldnt Have Webcams]]></title>\r
+                               <description><![CDATA[Someone.  Please.  Kill.  Him.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_why_little_kids_shouldnt_have_webcams.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_why_little_kids_shouldnt_have_webcams.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_why_little_kids_shouldnt_have_webcams_2.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_why_little_kids_shouldnt_have_webcams.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11793/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11793', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[kids,shouldnt,webcams]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="6">\r
+                               <crypId>11792</crypId>\r
+                               <title><![CDATA[Random Beams vs Passing Motorist]]></title>\r
+                               <description><![CDATA[Squish?  Ouch.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_random_beams_vs_passing_motorist.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_random_beams_vs_passing_motorist.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_random_beams_vs_passing_motorist_2.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_random_beams_vs_passing_motorist.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11792/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11792', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[beams,motorist,passing,random,vs]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="7">\r
+                               <crypId>11791</crypId>\r
+                               <title><![CDATA[Woman Almost Runs Over School Kids]]></title>\r
+                               <description><![CDATA[So, was school cancelled?]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_woman_almost_runs_over_school_kids.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_woman_almost_runs_over_school_kids.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_woman_almost_runs_over_school_kids_4.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_woman_almost_runs_over_school_kids.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11791/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11791', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[kids,runs,school,woman]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="8">\r
+                               <crypId>11790</crypId>\r
+                               <title><![CDATA[The Next Level of RC Chopper Pilots]]></title>\r
+                               <description><![CDATA[I have to say it just looks like it's having a seizure but I bet it's impossible to make it do that on purpose without crashing.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_the_next_level_of_rc_chopper_pilots.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_the_next_level_of_rc_chopper_pilots.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_the_next_level_of_rc_chopper_pilots_3.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_the_next_level_of_rc_chopper_pilots.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11790/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11790', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[chopper,level,next,pilots,rc]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="9">\r
+                               <crypId>11789</crypId>\r
+                               <title><![CDATA[Neat Color Changing Card Trick]]></title>\r
+                               <description><![CDATA[Well, being color blind this does nothing for me.  I'm sure it's cool though!]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_neat_color_changing_card_trick.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_neat_color_changing_card_trick.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_neat_color_changing_card_trick_4.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_neat_color_changing_card_trick.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11789/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11789', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[card,changing,color,neat,trick]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                                       <video order="10">\r
+                               <crypId>11788</crypId>\r
+                               <title><![CDATA[The Life of A Plant Sped Up]]></title>\r
+                               <description><![CDATA[If only it really grew that fast it would be on the street in pounds and not grams.]]></description>\r
+                               <url><![CDATA[http://www.yikers.com/video_the_life_of_a_plant_sped_up.html]]></url>\r
+                               <change_video><![CDATA[javascript:url_set('http://www.yikers.com/video_the_life_of_a_plant_sped_up.html')]]></change_video>\r
+                               <thumbnail><![CDATA[http://cdn.yikers.com/thumbs/yikers_the_life_of_a_plant_sped_up_4.jpg]]></thumbnail>\r
+                               <runtime>00:30</runtime>\r
+                               <comments>0</comments>\r
+                               <flv7></flv7>\r
+                               <flv8><![CDATA[http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flvflv/flash8/yikers_the_life_of_a_plant_sped_up.flv]]></flv8>\r
+                               <family>on</family>\r
+                               <share><![CDATA[javascript:url_set('http://www.yikers.com/tellafriend/11788/')]]></share>\r
+                               <fullscreen><![CDATA[javascript:window_open_minimal('http://www.yikers.com/fullscreen.php?cid=11788', 'fullscreen')]]></fullscreen>\r
+                               <ad_terms><![CDATA[life,plant,sped]]></ad_terms>\r
+                               <categories><![CDATA[entertainment]]></categories>\r
+                       </video>\r
+                       </video_playlist>\r
+</flvplayer>
\ No newline at end of file
index 26c595d8788aefd15d87b954d3e58048fb59efef..8987178cf32da249d6b1e82caac25522837fb44b 100644 (file)
@@ -23,6 +23,7 @@ require 'test/veoh_test'
 require 'test/uri_utilities_test'
 require 'test/vimeo_test'
 require 'test/website_test'
+require 'test/yikers_test'
 require 'test/youporn_test'
 require 'test/youtube_test'
 
diff --git a/test/yikers_test.rb b/test/yikers_test.rb
new file mode 100644 (file)
index 0000000..1c9548d
--- /dev/null
@@ -0,0 +1,93 @@
+#
+# 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 'test/unit'
+require 'src/websites/yikers'
+
+class YikersTest < Test::Unit::TestCase
+
+  def test_owns_yikers_urls
+    assert(Yikers.owns_url?('http://www.yikers.com/video_sexy_drunk_girl_crashes_dirtbike.html'))
+    assert(Yikers.owns_url?('http://www.yikers.com/video_almost_transformers.html'))
+    assert(Yikers.owns_url?('http://yikers.com/video_almost_transformers.html'))
+    assert(Yikers.owns_url?('www.yikers.com/video_noisy_drinking_cat.html'))
+    assert(Yikers.owns_url?('yikers.com/video_college_cafeteria_strip_off.html'))
+  end
+
+  
+  def test_doesnt_own_howcast_urls
+    assert(!Yikers.owns_url?('http://www.howcast.com/videos/6807-2twr'))
+    assert(!Yikers.owns_url?('www.howcast.com/videos/6807-2dgfdg'))
+    assert(!Yikers.owns_url?('http://howcast.com/videos/6807-cse'))
+    assert(!Yikers.owns_url?('howcast.com/videos/6807-asdgasd'))
+  end
+  
+    
+  def test_doesnt_own_redtube_urls
+    assert(!Yikers.owns_url?('http://www.redtube.com/6807'))
+    assert(!Yikers.owns_url?('www.redtube.com/6807'))
+    assert(!Yikers.owns_url?('http://redtube.com/6807'))
+    assert(!Yikers.owns_url?('redtube.com/6807'))
+  end
+
+  def test_doesnt_own_misc_urls
+    assert(!Yikers.owns_url?('http://www.howcast.com/abc'))
+  end
+
+  
+  def test_parse_xml_path
+    yikers = Yikers.new(nil)
+
+    page_data = nil
+    
+    File.open('test/fixtures/yikers/video_college_cafeteria_strip_off.html') do |f|
+      page_data = f.read
+    end
+    
+    test_result = yikers.send('parse_xml_path', page_data)
+    assert_equal('/flash/play_flash_xml.php?cid=11798', test_result)
+  end
+
+
+  def test_parse_video_url
+    yikers = Yikers.new(nil)
+
+    page_data = nil
+    
+    File.open('test/fixtures/yikers/video_college_cafeteria_strip_off.xml') do |f|
+      page_data = f.read
+    end
+    
+    test_result = yikers.send('parse_video_url', page_data)
+    assert_equal('http://cdn.yikers.com/flv/flash8/yikers_college_cafeteria_strip_off.flv', test_result)
+  end
+
+
+  def test_get_video_filename
+    yikers = Yikers.new('http://www.yikers.com/video_college_cafeteria_strip_off.html')
+    assert_equal('video_college_cafeteria_strip_off.flv', yikers.get_video_filename())
+  end
+
+
+  def test_uri_query_works_on_yikers_urls
+    uri = URI.parse('http://www.yikers.com/flash/play_flash_xml.php?cid=11798')
+    http_path = uri.path + '?' + uri.query
+    assert_equal('/flash/play_flash_xml.php?cid=11798', http_path)
+  end
+  
+end