]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Updated Redtube to work with the site's new algorithm.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Oct 2009 19:28:39 +0000 (15:28 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Oct 2009 19:28:39 +0000 (15:28 -0400)
Made one local Redtube test a remote test.
Updated the remote test suite to include the Redtube remote tests.
Added a local fixture for Redtube tests.
Added one local test utilizing the new fixture.

src/websites/redtube.rb
test/fixtures/redtube/6807.html [new file with mode: 0644]
test/redtube_remote_test.rb [new file with mode: 0644]
test/redtube_test.rb
test/remote_test_suite.rb

index 39ca90137a7f367f3c3d571b2c6261415b9c33c2..3b1a4fa5005641817a2f0cc4f87902e8d20f263f 100644 (file)
@@ -54,14 +54,29 @@ class Redtube < Website
     video_dir = self.get_video_dir(video_id)
     file_name = self.get_file_name(padded_id)
 
-    # This mess is actually the only directory out of
-    # which they serve videos.
-    return 'http://dl.redtube.com/_videos_t4vn23s9jc5498tgj49icfj4678/' +
-           "#{video_dir}/#{file_name}"
+    page_data = self.get_page_data(@url)
+
+    # As far as I know, the MP4s don't work yet.
+    # So just default to the FLV.
+    top_secret_hash = parse_hash_flv(page_data)
+
+    return 'http://dl.redtube.com/' +
+           self.get_root_server_dir() +
+           "/#{video_dir}/#{file_name}" +
+           top_secret_hash
   end
 
-  
-  protected
+
+  def get_video_filename()
+    # Mildly redundant.
+    video_id = parse_video_id()
+    padded_id = video_id.to_s.pad_left('0', 7)
+
+    return self.get_file_name(padded_id)
+  end
+
+
+  protected;
 
   VIDEO_FILE_EXTENSION = '.flv'
 
@@ -69,6 +84,28 @@ class Redtube < Website
     return /\d+/.match(@url)[0]
   end
 
+
+
+  def parse_hash_flv(page_data)
+    # Hashes are generated for both flv/mp4 and are delivered
+    # along with the video page. We need to stick them back on
+    # the end of the final video URL, or else it doesn't work.
+    hash_flv_regex = /&hash_flv=(\/.*?)&/
+
+    matches = hash_flv_regex.match(page_data)
+
+    if matches.nil?
+      raise StandardError.new("Couldn't parse the hash_flv variable.")
+    end
+
+    return matches[1]
+  end
+
+
+  def get_root_server_dir()
+    # They hard code this shit into the SWF file.
+    return '467f9bca32b1989277b48582944f325afa3374'
+  end
   
   # Not sure what they're thinking with this one.
   def get_video_dir(video_id)
diff --git a/test/fixtures/redtube/6807.html b/test/fixtures/redtube/6807.html
new file mode 100644 (file)
index 0000000..a269797
--- /dev/null
@@ -0,0 +1,425 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+       <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+       <meta name="robots" content="all" />
+       <meta name="verify-v1" content="PctNGXCjY50P4fX8QfNxayhlYfhwft5DVxq+ah40XdQ=" />
+       <meta name="msvalidate.01" content="ABD2C5EA05EF68190A151632F757D049" />
+       <meta name="revisit" content="1 day" />
+               <link href="http://thumbs.redtube.com/_thumbs/v2009/favicon.ico" rel="shortcut icon" />
+       <link rel="icon" href="http://thumbs.redtube.com/_thumbs/v2009/favicon.ico" type="image/ico" />
+
+       <link href="/css/style.css" rel="stylesheet" type="text/css" media="screen"/>
+       <link href="/css/developmentFixes.css" rel="stylesheet" type="text/css" media="screen"/>        
+       <link href="/css/layout.css" rel="stylesheet" type="text/css" media="screen"/>  
+       <link href="/css/watch.css" rel="stylesheet" type="text/css" media="screen"/>   
+       <link href="/css/legal.css" rel="stylesheet" type="text/css" media="screen"/>   
+       <link href="/css/bears.css" rel="stylesheet" type="text/css" media="screen"/>   
+       <script type="text/javascript" src="/js/swfobject.js"></script> 
+       <script type="text/javascript" src="/js/swfobject_modified.js"></script>        
+       <script type="text/javascript" src="/js/thumbchange.js"></script>       
+       <script type="text/javascript" src="/js/popup.js"></script>     
+       <script type="text/javascript" src="/js/rate.js"></script>      
+       
+               
+<!--[if IE]>
+       <style type="text/css">
+               h2.legal{font-weight:bold; margin-bottom:3px;}
+       </style>
+<![endif]-->
+<!--[if lt IE 8]>
+       <link href="/css/iefix.css" rel="stylesheet" type="text/css" media="screen"/>   
+<![endif]-->
+
+       <title>Cum in her ass - RedTube - Free Porn Videos</title>
+</head>
+
+<body>
+
+<div class="contentHolder">
+       <div class="content">
+               <div class="header">
+                       <div class="logo">
+                               <a title="RedTube - Home of Porn - Red Tube" href="http://www.redtube.com/">
+                                       <img src="http://thumbs.redtube.com/_thumbs/v2009/logo2009.png" alt="RedTube Free Sex Videos" />
+                               </a>
+                       </div>
+                       <div class="topAds">
+                               <a target="_blank" href="http://ads.redtube.com/click?id=1132&videoid=6807">
+                                       <img src="http://thumbs.redtube.com/_thumbs/banner/RTads/00001132.gif" />
+                               </a>
+                       </div>
+               </div>
+
+               <div class="navigation">
+                       <ul class="tabs">\r
+                               <li><a href="/new" class="new" title="New videos"  ></a></li>\r
+                               <li><a href="/channels" class="categories" title="Categories"  ></a></li>\r
+                               <li><a href="http://ads.redtube.com/click?id=435" class="live" title="Live Cams" target=_blank rel='nofollow'></a></li>\r
+                               <li><a href="http://ads.redtube.com/click?id=504" class="dating" title="Dating" target=_blank rel='nofollow'></a></li>\r
+                               <li><a href="http://ads.redtube.com/click?id=434" class="premium" title="Premium"  rel='nofollow'></a></li>\r
+                       </ul>\r
+\r
+                       <div class="searchForm">
+                               <form name="searchform" action="/new" method="get">
+                                       <input class="searchField" name="search" value="" type="text" />
+                                       <a class="searchButton" title="Search" href="javascript:document.searchform.submit();"></a>
+                               </form>
+                       </div>
+                       
+
+               </div>
+
+
+               <div style="display:none">
+                       <img id="sb0" src='http://thumbs.redtube.com/_thumbs/v2009/design/starb_0.gif' />
+                       <img id="sb1" src='http://thumbs.redtube.com/_thumbs/v2009/design/starb_1.gif' />
+                       <img id="sb2" src='http://thumbs.redtube.com/_thumbs/v2009/design/starb_2.gif' />
+                       <img id="sb0o" src='http://thumbs.redtube.com/_thumbs/v2009/design/starb_0o.gif' />
+                       <img id="sb2o" src='http://thumbs.redtube.com/_thumbs/v2009/design/starb_2o.gif' />
+               </div>
+               
+               <script type='text/javascript'>
+                       stat['0000791'] = 0;
+                       pic['0000791']  = new Array();
+                       pics['0000791'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0000794'] = 0;
+                       pic['0000794']  = new Array();
+                       pics['0000794'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0010766'] = 0;
+                       pic['0010766']  = new Array();
+                       pics['0010766'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0000795'] = 0;
+                       pic['0000795']  = new Array();
+                       pics['0000795'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0000796'] = 0;
+                       pic['0000796']  = new Array();
+                       pics['0000796'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0000797'] = 0;
+                       pic['0000797']  = new Array();
+                       pics['0000797'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0000798'] = 0;
+                       pic['0000798']  = new Array();
+                       pics['0000798'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0020533'] = 0;
+                       pic['0020533']  = new Array();
+                       pics['0020533'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0020649'] = 0;
+                       pic['0020649']  = new Array();
+                       pics['0020649'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       stat['0008967'] = 0;
+                       pic['0008967']  = new Array();
+                       pics['0008967'] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
+                       
+                       var ratings     = 3193+1;
+                       
+                       ratp[0] = 2;
+                       ratp[1] = 2;
+                       ratp[2] = 2;
+                       ratp[3] = 2;
+                       ratp[4] = 1;
+               </script>
+               
+               <h1 class="videoTitle">Cum in her ass</h1>
+               <div class="watch">
+                       <div class="videoPlayer">
+                               <div id="redtube_flv_player" align="center">
+                                       <script type="text/javascript">
+                                               var so  = new SWFObject("/_playerrt/player_25.swf", "redtubeplayer", "584", "458", "9.0.124.0", "#000000");
+                                               so.addParam("allowfullscreen","true");
+                                               so.addParam("allowscriptaccess","always");
+                                               so.addParam("autostart", "true");
+                                               so.addParam("flashvars","id=6807&width=584&height=458&vname=26657d5ff9020d2abefe558796b99584&hash_flv=/be03bc2d810017a8689d96c61a626303/4ac6529f&secured=true&hash_mp4=/8712b292d408217b4ab7e46595d8e713/4ac6529f&secured=true");
+                                               if(!so.write("redtube_flv_player")) {
+                                                       document.getElementById("redtube_flv_player").innerHTML = "<p style='margin-top:170px; text-align:center; font-size:16pt; font-weight:bold;'>You need the latest Flash player to see this video<br><br><a  rel='nofollow' href='http://www.macromedia.com/go/getflashplayer' style='text-align:center; font-size:16pt; font-weight:bold;'>Click here to get Adobe Flash player</a></p>";
+                                               }
+                                       </script>
+                                       <noscript>
+                                               <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="584" height="458" id="FlashID">
+                                                       <param name="movie" value="/_playerrt/player_25.swf" />
+                                                       <param name="bgcolor" value="#000000" />
+                                                       <param name="quality" value="high" />
+                                                       <param name="wmode" value="opaque" />
+                                                       <param name="FlashVars" value="id=6807&width=584&height=458&vname=26657d5ff9020d2abefe558796b99584&hash_flv=/be03bc2d810017a8689d96c61a626303/4ac6529f&secured=true&hash_mp4=/8712b292d408217b4ab7e46595d8e713/4ac6529f&secured=true" />
+                                                       <param name="swfversion" value="9.0.124.0" />
+                                                       <!-- This param tag prompts users with Flash Player 9.0 r124 and higher to download the latest version of Flash Player. Delete it if you don�t want users to see the prompt. -->
+                                                       <param name="expressinstall" value="Scripts/expressInstall.swf" />
+                                                       <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
+                                                       <!--[if !IE]>-->
+                                                       <object type="application/x-shockwave-flash" data="/_playerrt/player_25.swf" width="584" height="458">
+                                                       <!--<![endif]-->
+                                                               <param name="bgcolor" value="#000000" />
+                                                               <param name="quality" value="high" />
+                                                               <param name="wmode" value="opaque" />
+                                                               <param name="FlashVars" value="id=6807&width=584&height=458&vname=26657d5ff9020d2abefe558796b99584&hash_flv=/be03bc2d810017a8689d96c61a626303/4ac6529f&secured=true&hash_mp4=/8712b292d408217b4ab7e46595d8e713/4ac6529f&secured=true" />
+                                                               <param name="swfversion" value="9.0.124.0" />
+                                                               <param name="expressinstall" value="/js/expressInstall.swf" />
+                                                               <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
+                                                               <div>
+                                                                       <h3>You need Adobe Flash Player to see this video</h3>
+                                                                       <p><a href="http://www.adobe.com/go/getflashplayer">Get the Flash Player</a></p>
+                                                               </div>
+                                                       <!--[if !IE]>-->
+                                                       </object>
+                                                       <!--<![endif]-->
+                                               </object>
+                                       </noscript>
+                               </div>
+                       </div>
+               
+                       <div class="belowVideoAd">
+                               <a target="_blank" href="http://ads.redtube.com/click?id=1050&videoid=6807">
+                                       <img src="http://thumbs.redtube.com/_thumbs/banner/RTads/00001050.PNG" />
+                               </a>
+       
+                       </div>
+               </div>  
+               
+                       <div class="ntvAds">
+                               <div class="videoRating">
+                                       <h3 class="ratingTitle" id="ratetext">Rate this Video</h3>
+                                       <div class="ratingStars">
+                                               <a href="javascript:dorating(6807,1)" onMouseOver="ratingo(1)" rel="nofollow" onMouseOut="ratinga(1)">
+                                                       <img id="stb1" src="http://thumbs.redtube.com/_thumbs/v2009/design/starb_2.gif" alt="Rate Video 1/5" />
+                                               </a>
+                                               <a href="javascript:dorating(6807,2)" onMouseOver="ratingo(2)" rel="nofollow" onMouseOut="ratinga(2)">
+                                                       <img id="stb2" src="http://thumbs.redtube.com/_thumbs/v2009/design/starb_2.gif" alt="Rate Video 2/5" />
+                                               </a>
+                                               <a href="javascript:dorating(6807,3)" onMouseOver="ratingo(3)" rel="nofollow" onMouseOut="ratinga(3)">
+                                                       <img id="stb3" src="http://thumbs.redtube.com/_thumbs/v2009/design/starb_2.gif" alt="Rate Video 3/5" />
+                                               </a>
+                                               <a href="javascript:dorating(6807,4)" onMouseOver="ratingo(4)" rel="nofollow" onMouseOut="ratinga(4)">
+                                                       <img id="stb4" src="http://thumbs.redtube.com/_thumbs/v2009/design/starb_2.gif" alt="Rate Video 4/5" />
+                                               </a>
+                                               <a href="javascript:dorating(6807,5)" onMouseOver="ratingo(5)" rel="nofollow" onMouseOut="ratinga(5)">
+                                                       <img id="stb5" src="http://thumbs.redtube.com/_thumbs/v2009/design/starb_1.gif" alt="Rate Video 5/5" />
+                                               </a>
+                                       </div>
+                                       <p id="anzrattd">3,193 ratings</p>
+                                       <p class="submitted">Submitted by<br /><span>IDeepThroat</span></p>
+                                       <p class="share">
+                                               <a rel="nofollow" onclick='RTpopup("/share/6807", "", 280, 465); return false;' target="_blank" href="/share/6807">
+                                                       <img id="icoShare" src="http://thumbs.redtube.com/_thumbs/v2009/design/icon_share.gif" alt="Share" />
+                                               </a>
+                                               <a class="ratingLink" rel="nofollow" onclick='RTpopup("/share/6807", "", 280, 465); return false;' target="_blank" href="/share/6807">Share this Video</a>
+                                       </p>
+                                       <p class="embed">
+                                               <a rel="nofollow" onclick='RTpopup("/embed/6807", "", 340, 520); return false;' target="_blank" href="/embed/6807">
+                                                       <img id="icoEmbed" src="http://thumbs.redtube.com/_thumbs/v2009/design/icon_embed.gif" alt="Embed" />
+                                               </a>
+                                               <a class="ratingLink" rel="nofollow" onclick='RTpopup("/embed/6807", "", 340, 520); return false;' target="_blank" href="/embed/6807">Embed this video<br>on your website</a>
+                                       </p>
+                               </div>
+                               
+                               <div class="ntv">
+<iframe width="150" scrolling="no" height="240" frameborder="0" src="http://ads.redtube.com/iframe/ntv/brazzers013/index.php?clickTAG=http://ads.redtube.com/click?id=1186&videoid=6807" allowtransparency="true" marginheight="0" marginwidth="0" name="redtube"> </iframe>
+               
+                               </div>
+                       </div>
+               
+               <div class="relVideos">
+                       <h2>Related Videos</h2>
+                       <ul>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 8" class="ss" href="/791">Teen Maruskha part 8</a>
+                                       </h2>
+                                       <a href="/791"><img id="0000791" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000791/0000791_011s.jpg" onmouseout='endm("0000791"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000791/0000791_011s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000791","http://thumbs.redtube.com/_thumbs/0000000/0000791/0000791_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 8" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 6" class="ss" href="/794">Teen Maruskha part 6</a>
+                                       </h2>
+                                       <a href="/794"><img id="0000794" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000794/0000794_007s.jpg" onmouseout='endm("0000794"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000794/0000794_007s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000794","http://thumbs.redtube.com/_thumbs/0000000/0000794/0000794_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 6" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="It's good to fill all holes" class="ss" href="/10766">It's good to fill all holes</a>
+                                       </h2>
+                                       <a href="/10766"><img id="0010766" class="t" src="http://thumbs.redtube.com/_thumbs/0000010/0010766/0010766_006s.jpg" onmouseout='endm("0010766"); this.src="http://thumbs.redtube.com/_thumbs/0000010/0010766/0010766_006s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0010766","http://thumbs.redtube.com/_thumbs/0000010/0010766/0010766_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="It's good to fill all holes" /></a>
+                                       <div class="relTime"><span class="d">21:21</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_1.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 7" class="ss" href="/795">Teen Maruskha part 7</a>
+                                       </h2>
+                                       <a href="/795"><img id="0000795" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000795/0000795_001s.jpg" onmouseout='endm("0000795"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000795/0000795_001s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000795","http://thumbs.redtube.com/_thumbs/0000000/0000795/0000795_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 7" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li class="videoLast">
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 2" class="ss" href="/796">Teen Maruskha part 2</a>
+                                       </h2>
+                                       <a href="/796"><img id="0000796" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000796/0000796_008s.jpg" onmouseout='endm("0000796"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000796/0000796_008s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000796","http://thumbs.redtube.com/_thumbs/0000000/0000796/0000796_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 2" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 4" class="ss" href="/797">Teen Maruskha part 4</a>
+                                       </h2>
+                                       <a href="/797"><img id="0000797" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000797/0000797_001s.jpg" onmouseout='endm("0000797"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000797/0000797_001s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000797","http://thumbs.redtube.com/_thumbs/0000000/0000797/0000797_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 4" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Teen Maruskha part 5" class="ss" href="/798">Teen Maruskha part 5</a>
+                                       </h2>
+                                       <a href="/798"><img id="0000798" class="t" src="http://thumbs.redtube.com/_thumbs/0000000/0000798/0000798_002s.jpg" onmouseout='endm("0000798"); this.src="http://thumbs.redtube.com/_thumbs/0000000/0000798/0000798_002s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0000798","http://thumbs.redtube.com/_thumbs/0000000/0000798/0000798_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Teen Maruskha part 5" /></a>
+                                       <div class="relTime"><span class="d">02:11</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Blond busty ass soldier" class="ss" href="/20533">Blond busty ass soldier</a>
+                                       </h2>
+                                       <a href="/20533"><img id="0020533" class="t" src="http://thumbs.redtube.com/_thumbs/0000020/0020533/0020533_016s.jpg" onmouseout='endm("0020533"); this.src="http://thumbs.redtube.com/_thumbs/0000020/0020533/0020533_016s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0020533","http://thumbs.redtube.com/_thumbs/0000020/0020533/0020533_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Blond busty ass soldier" /></a>
+                                       <div class="relTime"><span class="d">17:07</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_1.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li >
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Sexy teen likes it in the ass after squirting" class="ss" href="/20649">Sexy teen likes it in the ass after squirting</a>
+                                       </h2>
+                                       <a href="/20649"><img id="0020649" class="t" src="http://thumbs.redtube.com/_thumbs/0000020/0020649/0020649_013s.jpg" onmouseout='endm("0020649"); this.src="http://thumbs.redtube.com/_thumbs/0000020/0020649/0020649_013s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0020649","http://thumbs.redtube.com/_thumbs/0000020/0020649/0020649_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Sexy teen likes it in the ass after squirting" /></a>
+                                       <div class="relTime"><span class="d">28:07</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_1.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                               <li class="videoLast">
+                                       <h2 class="twoRowsTitle">
+                                               <a title="Slut Katerina assfucked in pink panties" class="ss" href="/8967">Slut Katerina assfucked in pink panties</a>
+                                       </h2>
+                                       <a href="/8967"><img id="0008967" class="t" src="http://thumbs.redtube.com/_thumbs/0000008/0008967/0008967_012s.jpg" onmouseout='endm("0008967"); this.src="http://thumbs.redtube.com/_thumbs/0000008/0008967/0008967_012s.jpg"; this.style.border="solid 2px #A0A0A0";' onmouseover='startm("0008967","http://thumbs.redtube.com/_thumbs/0000008/0008967/0008967_","s.jpg"); this.style.border="solid 2px #CC0D12";' alt="Slut Katerina assfucked in pink panties" /></a>
+                                       <div class="relTime"><span class="d">04:39</span></div>
+                                       
+                                       <div class="relStars">
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_2.gif" alt="Rating" />
+                                               <img src="http://thumbs.redtube.com/_thumbs/v2009/design/star_0.gif" alt="Rating" />
+                                       </div>
+                               </li>
+                       </ul>
+               </div>
+               
+               <div class="relPremiumVideos">
+                       <h2>Related Premium Videos</h2>
+                       <div>
+<iframe style='margin:0px; margin-top:0px;' src='http://premium.redtube.com/tour/?action=relatedpremium&cat=2' width='765' height='355' scrolling=no marginheight=0 marginwidth=0 frameborder=0></iframe>
+                       </div>
+               </div>
+               
+
+               
+
+               
+               <div class="footer">
+
+
+                       <div class="legacy">
+                               <ul class="legalLinks">
+                                       <li><a title="Contact" rel="nofollow" href="/contact">Contact</a>&nbsp;|&nbsp;</li>
+                                       <li><a title="Terms Of Service" rel="nofollow" href="/terms">Terms</a>&nbsp;|&nbsp;</li>
+                                       <li><a title="Privacy" rel="nofollow" href="/privacy">Privacy</a>&nbsp;|&nbsp;</li>
+                                       <li><a title="DMCA" rel="nofollow" href="/dmca">DMCA</a>&nbsp;|&nbsp;</li>
+                                       <li><a title="USC 2257" rel="nofollow" href="/usc2257">2257</a></li>
+                               </ul>
+                               <div class="confirmAge">
+                                       By viewing RedTube you confirm that you have reached the legal age for viewing porn in your country
+                               </div>
+                       </div>
+               </div>
+               
+               <div class="bottomAds">
+<iframe name="Brazzers" src="http://ads.redtube.com/iframe/bottom/brazzers041/index.php?clickTAG=http://ads.redtube.com/click?id=1188&videoid=6807" width="775" height="265" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowTransparency="true"></iframe>
+               </div>
+       </div>
+       
+       <div class="towerAds">
+                               <a target="_blank" href="http://ads.redtube.com/click?id=988&videoid=6807">
+                                       <img src="http://thumbs.redtube.com/_thumbs/banner/RTads/00000988.jpg" />
+                               </a>
+       </div>
+
+       <div class="profile">
+       </div>
+
+</div>
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type='text/javascript'>var pageTracker = _gat._getTracker("UA-2376569-1"); pageTracker._trackPageview('watchv2009'); </script>
+</body>
+</html>
diff --git a/test/redtube_remote_test.rb b/test/redtube_remote_test.rb
new file mode 100644 (file)
index 0000000..6bf44c7
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# 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/redtube'
+
+
+class RedtubeRemoteTest < Test::Unit::TestCase
+
+  def test_get_video_url
+    # Won't work locally because we need the hash_flv attribute from the page.    
+    rt = Redtube.new('http://www.redtube.com/6807')
+    expected_result = 'http://dl.redtube.com/467f9bca32b1989277b48582944f325afa3374/0000006/X57OBH08G.flv/1a9f62001c523752dc9a6bc3f7f5acad/4ac64671'
+    actual_result = rt.get_video_url()
+    assert_equal(expected_result, actual_result)
+  end
+
+end
index 9d6c709120fc0a3f46b5a948741629dffa2d1ee7..e226f815b9550a1a928bb5b82193e852aa1a8963 100644 (file)
@@ -46,14 +46,6 @@ class RedtubeTest < Test::Unit::TestCase
   end
 
   
-  def test_get_video_url
-    rt = Redtube.new('http://www.redtube.com/6807')
-    expected_result = 'http://dl.redtube.com/_videos_t4vn23s9jc5498tgj49icfj4678/0000006/X57OBH08G.flv'
-    actual_result = rt.get_video_url()
-    assert_equal(expected_result, actual_result)
-  end
-
-  
   def test_get_video_filename
     rt = Redtube.new('http://www.redtube.com/6807')
     # I don't know where they get these filenames from, but whatever.
@@ -61,4 +53,20 @@ class RedtubeTest < Test::Unit::TestCase
     actual_result = rt.get_video_filename()
     assert_equal(expected_result, actual_result)
   end
+
+
+
+  def test_parse_hash_flv
+    rt = Redtube.new(nil)
+
+    page_data = nil
+
+    File.open('test/fixtures/redtube/6807.html') do |f|
+      page_data = f.read
+    end
+
+    test_result = rt.send('parse_hash_flv', page_data)
+    assert_equal('/be03bc2d810017a8689d96c61a626303/4ac6529f', test_result)
+  end
+
 end
index 5068cf1dea4e1fcae16267d1802a2a09667830c6..be135f724394668757531e9499c4802538b0ef33 100644 (file)
@@ -18,5 +18,6 @@
 
 require 'test/fuckedtube_remote_test'
 require 'test/infoq_remote_test'
+require 'test/redtube_remote_test'
 require 'test/uri_utilities_remote_test'
 require 'test/youporn_remote_test'