]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/commitdiff
Added the beginnings of Megaporn support. There's still something missing, but the...
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Mar 2009 04:37:32 +0000 (00:37 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Mar 2009 04:37:32 +0000 (00:37 -0400)
src/websites/megaporn.rb [new file with mode: 0644]
test/fixtures/megaporn/E1LROW6E.html [new file with mode: 0644]
test/megaporn_test.rb [new file with mode: 0644]
test/test_suite.rb

diff --git a/src/websites/megaporn.rb b/src/websites/megaporn.rb
new file mode 100644 (file)
index 0000000..bbd55c2
--- /dev/null
@@ -0,0 +1,173 @@
+#
+# 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
+#
+
+# jcode still needed for String.each_char in Ruby 1.8.6.
+require 'jcode'
+require 'src/website'
+
+class Megaporn < Website
+
+  VALID_MEGAPORN_URL_REGEX = /^(http:\/\/)?(www\.)?(megaporn|megavideo)\.com\/video\/\?v=[[:alnum:]]+$/
+  
+  def self.owns_url?(url)
+    return url =~ VALID_MEGAPORN_URL_REGEX
+  end
+
+
+  def get_video_filename
+    # Just use the video id.
+    id_regex = /v=([[:alnum:]]+)/
+    matches = id_regex.match(@url)
+
+    if (matches.nil? || matches.length < 2)
+      return 'default.flv'
+    else
+      return (matches[1] + '.flv')
+    end
+  end
+
+  
+  def get_video_url()
+    data = get_page_data(@url)
+    
+    # Megaporn attaches a numeric suffix to their 'www'
+    # hostname that (I suppose) is necessary to find the
+    # video file. The suffix is simply provided as a flash
+    # variable, though.    
+    host_suffix = parse_flash_variable(data, 's')
+
+    # There are also two or three keys, sent as Flash variables,
+    # that are used in the "decryption" routine. We get integers
+    # to be on the safe side.
+    key1 = parse_flash_variable(data, 'k1').to_i
+    key2 = parse_flash_variable(data, 'k2').to_i
+
+    # This is a magic hex string, passed to the decryption
+    # routine along with key1 and key2.
+    seed = parse_flash_variable(data, 'un')
+
+    secret_path = self.decrypt(seed, key1, key2)
+
+    # Note that the path to the video file looks like a folder.
+    # We need to remember to save it as a file.
+    return "http://www#{host_suffix}.#{self.domain}/videos/#{secret_path}/"
+  end
+
+  
+  protected
+
+  def domain
+    # I'm guessing they serve videos from both of these domains.
+    if (@url.include?('megavideo.com'))
+      return 'megavideo.com'
+    else
+      return 'megaporn.com'
+    end
+  end
+
+  
+  def parse_flash_variable(data, variable_name)
+    # The Flash variables differ only in name, so this method can
+    # parse them all.
+    var_regex = /flashvars\.#{variable_name} = \"(.+?)\"/
+    matches = var_regex.match(data)
+    
+    if (matches.nil? || matches.length < 2)
+      raise StandardError.new("Could not parse Flash variable: #{variable_name}.")
+    end
+
+    return matches[1]
+  end
+  
+
+  def string_to_binary_array(target_string)
+    binary_array = []
+
+    target_string.each_char do |c|
+      binary_int = c.to_i(16).to_s(2).to_i
+      binary_char = sprintf('%04d', binary_int)
+      binary_char.each_char do |bc|
+        binary_array << bc
+      end
+    end
+
+    return binary_array
+  end
+
+
+  def binary_words_to_hex(target_array)
+    hex = ''
+
+    target_array.each do |word|
+      hex << word.to_i(2).to_s(16)
+    end
+    
+    return hex
+  end
+  
+  
+  def decrypt(seed, key1, key2)
+    # I reverse-engineered this one myself. Suck it, megaporn.
+    #
+    # Round 1. Convert the seed to its binary reprentation,
+    # storing each bit as an element of an array.
+    loc1 = string_to_binary_array(seed)
+
+    # Round 2
+    loc6 = []
+    key1 = key1.to_i
+    key2 = key2.to_i
+    0.upto(383) do |loc3|
+      key1 = (key1 * 11 + 77213) % 81371
+      key2 = (key2 * 17 + 92717) % 192811
+      loc6[loc3] = (key1 + key2) % 128
+    end
+
+
+    # Round 3
+    256.downto(0) do |loc3|
+      loc5 = loc6[loc3]
+      loc4 = loc3 % 128
+      loc8 = loc1[loc5]
+      loc1[loc5] = loc1[loc4]
+      loc1[loc4] = loc8
+    end
+
+    
+    # Round 4
+    0.upto(127) do |loc3|
+      loc1[loc3] = (loc1[loc3].to_i ^ loc6[loc3 + 256]) & 1
+    end
+
+
+    # Round 5
+    loc12 = loc1.to_s
+    offset = 0
+    loc7 = []
+    while (offset < loc12.length)
+      loc7 << loc12[offset, 4];
+      offset += 4
+    end
+
+
+    # Round 6
+    return binary_words_to_hex(loc7)
+  end
+
+  
+end
diff --git a/test/fixtures/megaporn/E1LROW6E.html b/test/fixtures/megaporn/E1LROW6E.html
new file mode 100644 (file)
index 0000000..0b2a2df
--- /dev/null
@@ -0,0 +1,1326 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+
+
+<link rel="icon" href="http://wwwstatic.megaporn.com/images2/icomp.ico" type="image/x-icon">
+<link rel="shortcut icon" href="http://wwwstatic.megaporn.com/images2/icomp.ico" type="image/x-icon">
+
+<HEAD>
+<TITLE>Megaporn Video</TITLE>
+<script type="text/javascript" src="swfobject2.js"></script>
+</HEAD>
+
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+
+
+
+<link href="mvstyles.css" rel="stylesheet" type="text/css">
+
+
+<style type="text/css">
+body 
+{
+       text-align:center;
+       padding:0; margin:0;
+       background-image:url('http://wwwstatic.megarotic.com/video/gui/bg.gif');
+       font-family: arial;
+       font-size: 11px;
+       text-align: left;
+}
+
+
+#main 
+{
+       width:997px;
+       position: relative;
+       margin-top:0px;
+       text-align:center;
+}
+#mainpage
+{
+  position:absolute;
+  top:0px; left:0px;
+  width:977px;
+  text-align:left;
+}
+
+#mv1
+{
+  position:absolute;
+  top:3px; left:0px;
+  width:979px; height:204px;
+}
+#mv2
+{
+  position:absolute;
+  top:108px; left:1px;
+  width:977px; height:56px;
+  background-image:url('http://wwwstatic.megarotic.com/video/gui/shadow.gif');
+}
+
+a
+{
+  font-family:arial;
+}
+
+
+
+.button
+{
+       border: 1px solid #F21F77;
+       background-color: #F4F2EB;
+}
+
+</style>
+
+
+
+
+<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">
+try {
+var pageTracker = _gat._getTracker("UA-6383685-2");
+pageTracker._trackPageview();
+} catch(err) {}</script>
+
+
+
+<BODY onresize="resizing();">
+
+
+<script type="text/javascript">
+document.domain = 'megaporn.com';
+</script>
+
+
+
+<script language="JavaScript" type="text/javascript">
+
+
+
+       function selectLang(idx) {
+          var locale = locales[idx];
+          collapseLandLangPulldown();
+          changelang(idx)
+       }
+
+       function hiLight(langImg, idx, over) {
+          langImg.src = (over) ? langOverImgs[idx].src : langImgs[idx].src;
+       }
+
+       function createTooltip(id) {
+          var tt = document.createElement("DIV");
+          tt.id = id;
+          tt.style.border='none';
+          tt.style.position='absolute';
+          document.body.appendChild(tt);
+          return tt;
+       }
+
+       function findPos(obj) {
+               var curleft = 0;
+               var curtop = 0;
+               if (obj.offsetParent) {
+                       curleft = obj.offsetLeft
+                       curtop = obj.offsetTop
+                       while (obj = obj.offsetParent) {
+                               curleft += obj.offsetLeft
+                               curtop += obj.offsetTop
+                       }
+               }
+               return [curleft,curtop];
+       }
+
+       function getLangPulldownMenu(img) {
+               var pdDiv = createTooltip('langselection');
+               var top = img.clientY;
+               var pos = findPos(img);
+               pdDiv.style.left = (pos[0] + 3) + 'px';
+               pdDiv.style.top = (pos[1]+ 21) + 'px';
+               return pdDiv;
+       }
+
+       function runLangPulldown(img) {
+               var langPulldown = document.getElementById('langselection');
+               if (langPulldown != null) {
+                       collapseLandLangPulldown()
+               }
+               else {
+                       expandLangPulldown(img);
+               }
+       }
+
+       function collapseLandLangPulldown() {
+               var langPulldown = document.getElementById('langselection');
+               if (langPulldown != null) {
+                       langPulldown.style.visibility='hidden';
+                       document.body.removeChild(langPulldown);
+                       langPulldown = null;
+               }
+       }
+
+       function expandLangPulldown(img) {
+               var langPulldown = getLangPulldownMenu(img);
+               langPulldown.innerHTML=getPulldownHTML();
+               langPulldown.style.visibility='visible';
+       }
+
+       function getPulldownHTML() 
+       {
+               var pulldownHTML = '<table cellpadding="0" cellspacing="0" border="0" id="langSelection" class="lang_pulldown">';
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/en.gif" border="0" width="129" height="25" onclick="javascript:selectLang(0)" onMouseOut="javascript:hiLight(this, 0, false)" onMouseOver="javascript:hiLight(this, 0, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/de.gif" border="0" width="129" height="21" onclick="javascript:selectLang(1)" onMouseOut="javascript:hiLight(this, 1, false)" onMouseOver="javascript:hiLight(this, 1, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/fr.gif" border="0" width="129" height="21" onclick="javascript:selectLang(2)" onMouseOut="javascript:hiLight(this, 2, false)" onMouseOver="javascript:hiLight(this, 2, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/es.gif" border="0" width="129" height="21" onclick="javascript:selectLang(3)" onMouseOut="javascript:hiLight(this, 3, false)" onMouseOver="javascript:hiLight(this, 3, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/pt.gif" border="0" width="129" height="21" onclick="javascript:selectLang(4)" onMouseOut="javascript:hiLight(this, 4, false)" onMouseOver="javascript:hiLight(this, 4, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/nl.gif" border="0" width="129" height="21" onclick="javascript:selectLang(5)" onMouseOut="javascript:hiLight(this, 5, false)" onMouseOver="javascript:hiLight(this, 5, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/it.gif" border="0" width="129" height="21" onclick="javascript:selectLang(6)" onMouseOut="javascript:hiLight(this, 6, false)" onMouseOver="javascript:hiLight(this, 6, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/cn.gif" border="0" width="129" height="21" onclick="javascript:selectLang(7)" onMouseOut="javascript:hiLight(this, 7, false)" onMouseOver="javascript:hiLight(this, 7, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/ct.gif" border="0" width="129" height="21" onclick="javascript:selectLang(8)" onMouseOut="javascript:hiLight(this, 8, false)" onMouseOver="javascript:hiLight(this, 8, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/jp.gif" border="0" width="129" height="21" onclick="javascript:selectLang(9)" onMouseOut="javascript:hiLight(this, 9, false)" onMouseOver="javascript:hiLight(this, 9, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/kr.gif" border="0" width="129" height="21" onclick="javascript:selectLang(10)" onMouseOut="javascript:hiLight(this, 10, false)" onMouseOver="javascript:hiLight(this, 10, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/ru.gif" border="0" width="129" height="21" onclick="javascript:selectLang(11)" onMouseOut="javascript:hiLight(this, 11, false)" onMouseOver="javascript:hiLight(this, 11, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/fi.gif" border="0" width="129" height="21" onclick="javascript:selectLang(12)" onMouseOut="javascript:hiLight(this, 12, false)" onMouseOver="javascript:hiLight(this, 12, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/se.gif" border="0" width="129" height="21" onclick="javascript:selectLang(13)" onMouseOut="javascript:hiLight(this, 13, false)" onMouseOver="javascript:hiLight(this, 13, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/dk.gif" border="0" width="129" height="21" onclick="javascript:selectLang(14)" onMouseOut="javascript:hiLight(this, 14, false)" onMouseOver="javascript:hiLight(this, 14, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/tr.gif" border="0" width="129" height="21" onclick="javascript:selectLang(15)" onMouseOut="javascript:hiLight(this, 15, false)" onMouseOver="javascript:hiLight(this, 15, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/sa.gif" border="0" width="129" height="21" onclick="javascript:selectLang(16)" onMouseOut="javascript:hiLight(this, 16, false)" onMouseOver="javascript:hiLight(this, 16, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/vn.gif" border="0" width="129" height="21" onclick="javascript:selectLang(17)" onMouseOut="javascript:hiLight(this, 17, false)" onMouseOver="javascript:hiLight(this, 17, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+                               pulldownHTML = pulldownHTML.concat('<tr class="lang_pulldown">');
+               pulldownHTML = pulldownHTML.concat('<td class="lang_pulldown"><img src="http://wwwstatic.megaporn.com/video/gui/language_object/pl.gif" border="0" width="129" height="21" onclick="javascript:selectLang(18)" onMouseOut="javascript:hiLight(this, 18, false)" onMouseOver="javascript:hiLight(this, 18, true)"/></td>');
+               pulldownHTML = pulldownHTML.concat('</tr>');
+               
+               return pulldownHTML;
+       }
+
+       function autoSenseLang() {
+               try {
+                       var url = window.location.href;
+                       var locale = getLocale();
+                       if (undefined == locale) {
+                               return;
+                       }
+                       if ('en_US' != locale && url.indexOf('/' + locale + '/') == -1) {
+                               window.location.href = '/' + locale;
+                       }
+               }
+               catch (error) {
+                       ;
+               }
+       }
+
+       function getLangFromURL() {
+               var url = window.location.href;
+               var lang = locales[0];
+               for (var i=1; i < locales.length; i++) {
+                       if (url.indexOf('/' + locales[i] + '/') != -1) {
+                               lang = locales[i];
+                               break;
+                       }
+               }
+               return lang;
+       }
+
+       function getUnique(max) {
+               var now = new Date();
+               return (now.getMilliseconds() * Math.floor(Math.random()*max+1));
+       }
+
+       function isWin() {
+               return (navigator.platform.indexOf('Win') != -1);
+       }
+
+       function isVista() {
+               return (navigator.userAgent.indexOf("Windows NT 6.0") != -1);
+       }
+
+       function isMac() {
+               return (navigator.platform.indexOf('Mac') != -1);
+       }
+
+       function isLinux() {
+               return (navigator.platform.indexOf('Linux') != -1);
+       }
+
+
+
+
+
+
+       function addCacheBreakerToURL(url) {
+               var ran_number= getUnique(8);
+               var firstLetter = (url.indexOf('?')<0) ? '?' : '&';
+               return url + firstLetter + 'bznetid=' + ran_number;
+       }
+
+
+       function logout()
+       {
+         document.getElementById('logoutform').submit();
+       }
+
+
+       
+
+       function changelang(id)
+       {
+               if (id == 0)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=en';
+               }
+               if (id == 1)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=de';
+               }
+               if (id == 2)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=fr';
+               }
+               if (id == 3)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=es';
+               }
+               if (id == 4)
+               {
+               document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=pt';
+               }
+               if (id == 5)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=nl';
+               }
+               if (id == 6)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=it';
+               }
+               if (id == 7)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=cn';
+               }
+               if (id == 8)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=ct';
+               }
+               if (id == 9)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=jp';
+               }
+               if (id == 10)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=kr';
+               }
+               if (id == 11)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=ru';
+               }
+               if (id == 12)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=fi';
+               }
+               if (id == 13)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=se';
+               }
+               if (id == 14)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=dk';
+               }
+               if (id == 15)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=tr';
+               }
+               if (id == 16)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=sa';
+               }
+               if (id == 17)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=vn';
+               }
+               if (id == 18)
+               {
+                       document.location = 'http://www.megaporn.com/video/?v=E1LROW6E&setlang=pl';
+               }
+       }
+       </script>
+
+
+
+<center>
+<div style="position:absolute; display:none;">
+<form method="post" id="logoutform" action="?">
+<input type="hidden" name="logout" value="1">
+</form>
+</div>
+
+
+<script type="text/javascript">
+menu1 = new Image(151,29);
+menu1over = new Image(151,29);
+menu1over.src = 'http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_o_01.gif';
+menu2 = new Image(150,29);
+menu2over = new Image(150,29);
+menu2over.src = 'http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_o_02.gif';
+menu3 = new Image(150,29);
+menu3over = new Image(150,29);
+menu3over.src = 'http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_o_03.gif';
+menu4 = new Image(150,29);
+menu4over = new Image(150,29);
+menu4over.src = 'http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_o_04.gif';
+
+
+flag = new Image(135,28);
+flagover = new Image(135,28);
+flagover.src = 'http://wwwstatic.megaporn.com/video/mvgui/language_object/en_a_o.gif';
+</script>
+
+
+
+
+<TABLE width="100%" background="http://wwwstatic.megaporn.com/video/mvgui/top_bgr.gif" cellpadding="0" cellspacing="0">
+<TR>
+       <TD height="80" align="center"><center><div style="position:relative; width:980px; height:80px;">
+
+       <div style="position:absolute; left:0px; top:7px;"><a href="?"><IMG SRC="http://wwwstatic.megaporn.com/video/gui/logo_mprn.gif" WIDTH="305" HEIGHT="39" BORDER="0" ALT=""></a><FORM method="GET" id="searchfrm">
+       <input type="hidden" name="c" value="search"></div>
+       
+
+               
+       
+       <div style="position:absolute; left:622px; top:11px; background-image:url('http://wwwstatic.megaporn.com/video/mvgui/search_field.gif'); width:187px; height:28px;">
+       <div style="position:absolute; left:6px; top:4px;"><input type="text" name="s" style="background-color:#FFFFFF; border:none; width:179px;" value="Search videos" onclick="this.value='';"></div>
+       </div>
+
+       <div style="position:absolute; left:809px; top:11px;">
+       <script type="text/javascript">
+       searchbutton = new Image(35,28);
+       searchbuttono = new Image(35,28);
+       searchbuttono.src = 'http://wwwstatic.megaporn.com/video/mvgui/search_o.gif';
+       </script>
+
+       <div style="position:relative; width:40px; height:28px; cursor:pointer;" onclick="document.getElementById('searchfrm').submit();"><div style="position:absolute; left:0px; top:0px;"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/search.gif" WIDTH="35" HEIGHT="28" BORDER="0" ALT="" onmouseover="searchbutton.src=this.src; this.src=searchbuttono.src;" onmouseout="this.src=searchbutton.src;"></div><div style="position:absolute; left:0px; top:6px; width:40px; text-align:center; font-family:arial; font-size:12px; color:#000000; font-weight:normal; text-decoration:none;"></div></FORM></div>
+
+       </div>
+
+
+       <script type="text/javascript">
+       langbut = new Image(135,28);
+       langbuto = new Image(135,28);
+       langbuto.src = 'http://wwwstatic.megaporn.com/video/mvgui/lang_o.gif';
+       </script>
+
+       <div style="position:absolute; left:845px; top:9px;">
+       <table  border="0" cellspacing="0" cellpadding="1">
+         <tr>
+               <td width="140"><table width="100" border="0" align="right" cellpadding="1" cellspacing="0">
+                       <tr bgcolor="">
+                         <td width="125"><img src="http://wwwstatic.megaporn.com/video/mvgui/language_object/en_a.gif" alt="language" width="135" height="28" border="0" id="selectedLangImg" onclick="javascript:runLangPulldown(this)" onmouseover="langbut.src=this.src; this.src=langbuto.src;" onmouseout="this.src=langbut.src;" /></td>
+                       </tr>
+                 </table>
+                 </td>
+         </tr>
+       </table>
+       </div>
+
+       
+
+
+               <div style="position:absolute; left:410px; top:14px; width:200px; text-align:right;"><a href="?s=signup" style="font-family:arial; font-weight:normal; color:#000000; font-size:12px;">Login</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="?s=signup"  style="font-family:arial; font-weight:normal; color:#000000; font-size:12px;">Register</a></div>
+       
+       
+
+
+       <div style="position:absolute; left:190px; top:50px;">
+       <TABLE cellpadding="0" cellspacing="0">
+       <TR>
+               <TD><a href="?c=videos"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_01.gif" WIDTH="151" HEIGHT="29" BORDER="0" ALT="" onmouseover="menu1.src=this.src; this.src=menu1over.src;" onmouseout="this.src=menu1.src;"></a></TD>
+               <TD><a href="?c=premium"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_02.gif" WIDTH="150" HEIGHT="29" BORDER="0" ALT="" onmouseover="menu2.src=this.src; this.src=menu2over.src;" onmouseout="this.src=menu2.src;"></a></TD>
+               <TD><a href="?c=rewards"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_03.gif" WIDTH="150" HEIGHT="29" BORDER="0" ALT="" onmouseover="menu3.src=this.src; this.src=menu3over.src;" onmouseout="this.src=menu3.src;"></a></TD>
+               <TD><a href="?c=upload"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/menu/en/mvmenu_04.gif" WIDTH="150" HEIGHT="29" BORDER="0" ALT="" onmouseover="menu4.src=this.src; this.src=menu4over.src;" onmouseout="this.src=menu4.src;"></a></TD>
+       </TR>
+       </TABLE>
+       </div>
+       
+
+
+
+       
+       </div></center></TD>
+</TR>
+</TABLE>
+
+
+
+<script type="text/javascript">
+
+
+var cinmode = '';
+
+function cinemamode(mode)
+{
+  if (mode == 1)
+  {
+       // turn on
+    resizecinema();
+       cinmode=1;
+       document.getElementById('playerdiv').style.zIndex = '100';
+       document.getElementById('cinemamenu_on').style.display = 'none';
+       changeOpac(0,'dimlights1');
+       document.getElementById('dimlights1').style.display = '';
+       opacity('dimlights1', 0, 75, 750);
+       setTimeout("document.getElementById('cinemamenu_off').style.display = '';",750);
+  }
+  else
+  {
+       // turn off
+       document.getElementById('cinemamenu_off').style.display = 'none';
+       opacity('dimlights1', 75, 0, 500);
+       setTimeout("document.getElementById('playerdiv').style.zIndex = '0';",750);
+       setTimeout("document.getElementById('dimlights1').style.display='none';",750);
+       setTimeout("document.getElementById('cinemamenu_on').style.display = '';",750);
+       cinmode=0;
+  }
+}
+
+function opacity(id, opacStart, opacEnd, millisec) { 
+    //speed for each frame 
+    var speed = Math.round(millisec / 100); 
+    var timer = 0; 
+
+    //determine the direction for the blending, if start and end are the same nothing happens 
+    if(opacStart > opacEnd) { 
+        for(i = opacStart; i >= opacEnd; i--) { 
+            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
+            timer++; 
+        } 
+    } else if(opacStart < opacEnd) { 
+        for(i = opacStart; i <= opacEnd; i++) 
+            { 
+            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
+            timer++; 
+        } 
+    } 
+} 
+
+//change the opacity for different browsers 
+function changeOpac(opacity, id) { 
+    var object = document.getElementById(id).style; 
+    object.opacity = (opacity / 100); 
+    object.MozOpacity = (opacity / 100); 
+    object.KhtmlOpacity = (opacity / 100); 
+    object.filter = "alpha(opacity=" + opacity + ")"; 
+} 
+
+function resizecinema()
+{
+  document.getElementById('dimlights1').style.width  = document.body.clientWidth;
+  document.getElementById('dimlights1').style.height = document.body.clientHeight;
+}
+
+</script>
+
+
+<div style="position:absolute; left:0px; top:0px; width:1900px; height:1080px; background-color:#000000; filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70; z-index:1; display:none;" id="dimlights1"></div>
+
+
+
+<TABLE width="100%" background="http://wwwstatic.megaporn.com/video/mvgui/big_vid_bg.gif" cellpadding="0" cellspacing="0" style="" id="playerbg" bgcolor="#666563">
+<TR>
+       <TD height="450" align="center" valign="top" style="padding-left:1px;" id="playertd">
+       <center>
+       <div style="position:relative; background-color:#000000; width:800px; height:450px;" id="playerdiv" onmouseout="javascript:playerout();">
+       <div id="playercontainer">
+       <TABLE cellpadding="0" cellspacing="0">
+       <TR>
+               <TD height="450" width="800" align="center" valign="middle">
+               <a href="http://www.adobe.com/go/getflash" target="_blank" style="color:#FFFFFF; font-family:arial; font-size:16px; font-weight:bold; text-decoration:none;">Please upgrade to the latest version of the Adobe Flash player.</font></a><br><br><br>
+               <a href="http://www.adobe.com/go/getflash" target="_blank"><IMG SRC="gui/getflash.gif" WIDTH="158" HEIGHT="39" BORDER="0" ALT=""></a><br><br><br>
+
+               <noscript><div style="color:#FFFFFF; font-family:arial; font-size:16px; font-weight:bold; text-decoration:none; width:700px;">Please enable Javascript/ActiveScripting.<br>Make sure that your browser is not blocking Javascript on this site.</div></noscript>
+               </TD>
+       </TR>
+       </TABLE>
+       </div>
+       </div>
+       </center>
+
+
+       <script type="text/javascript">
+       
+       var flashvars = {};
+       
+       flashvars.added = "March+19+%2C+2009";
+       flashvars.username = "sexsuni";
+       flashvars.title = "Nude+In+The+Crowd";
+       flashvars.description = "She+is+walking+nude+in+the+crowd.+Its+so+funny+to+see+the+reaction+of+the+people+around+her+hahaha..";
+       flashvars.views = "52090";
+       flashvars.comments = "3";
+       flashvars.favorited = "25";
+       flashvars.category = "Hardcore";
+       flashvars.tags = "Nude+In+the+Public";
+       flashvars.rating = "100";
+       flashvars.des01 = "Show details";
+       flashvars.des02 = "Embed video";
+       flashvars.des03 = "Show URL of video";
+       flashvars.des04 = "Upload new video";
+       flashvars.des05 = "Download original";
+       flashvars.des06a = "Switch to fullscreen mode";
+       flashvars.des06b = "Switch to window mode";
+       flashvars.des07a = "Switch to 4:3";
+       flashvars.des07b = "Switch to 16:9";
+       flashvars.des07c = "Switch to original aspect ratio";
+       flashvars.des08 = "Comment on this video";
+       flashvars.des09 = "Open chat - coming soon";
+       flashvars.des10 = "Email to a friend";
+       flashvars.des11a = "Save to favorites";
+       flashvars.des11b = "Save to favorites (log in)";
+       flashvars.des12 = "Advertising";
+       flashvars.cancel = "Cancel";
+       flashvars.ok = "Ok";
+       flashvars.close = "close";
+       flashvars.send = "Send";
+       flashvars.det01 = "Poor";
+       flashvars.det02 = "Nothing special";
+       flashvars.det03 = "Worth watching";
+       flashvars.det04 = "Pretty cool";
+       flashvars.det05 = "Excellent";
+       flashvars.det06 = "Thank you for rating";
+       flashvars.det07 = "You must be logged in to rate";
+       flashvars.det08 = "An error occured processing your vote";
+       flashvars.det09 = "Added";
+       flashvars.det10 = "By";
+       flashvars.det11 = "Views";
+       flashvars.det12 = "Comments";
+       flashvars.det13 = "Favored";
+       flashvars.det14 = "Category";
+       flashvars.det15 = "Tags";
+       flashvars.det16 = "Rate this video";
+       flashvars.det17 = "Added to favorites";
+       flashvars.det18 = "Save to favorites";
+       flashvars.det19 = "Flag as inappropriate";
+       flashvars.det20 = "Download original";
+       flashvars.dfi01 = "An error occured";
+       flashvars.dfi02 = "A security error occured";
+       flashvars.dfi03 = "Downloading ";
+       flashvars.dfi04 = "URL of file";
+       flashvars.dfi05 = "External download";
+       flashvars.dfi06 = "Download in player";
+       flashvars.dfi07 = "Re-download";
+       flashvars.dfi08 = "Retry";
+       flashvars.over1 = "You have watched ";
+       flashvars.over2a = " minute of video today.";
+       flashvars.over2b = " minutes of video today.";
+       flashvars.over3 = "Please wait ";
+       flashvars.over4a = " minute or click here to enjoy unlimited use of Megaporn.";
+       flashvars.over4b = " minutes or click here to enjoy unlimited use of Megaporn.";
+       flashvars.emb01 = "Click on the following HTML code to copy it into clipboard and -paste it to your site's HTML code.";
+       flashvars.emb02 = "Embedding disabled by video owner.";
+       flashvars.stf01 = "Please check your email address";
+       flashvars.stf02 = "Please check recepient's email address";
+       flashvars.stf03 = "Your email was successfully sent.";
+       flashvars.stf04 = "An error occured, please try again later.";
+       flashvars.stf05 = "Friend's e-mail";
+       flashvars.stf06 = "Your email";
+       flashvars.stf07 = "Your message";
+       flashvars.fav01 = "Do you wish to add this video to your favorites?";
+       flashvars.fav02 = "Processing, please wait...";
+       flashvars.fav03 = "Added to favorites";
+       flashvars.fav04 = "An error occured, please try again later.";
+       flashvars.com01 = "Post new comment";
+       flashvars.com02 = "Back to video";
+       flashvars.com03 = "Loading data, please wait";
+       flashvars.com04 = "Enter your comment";
+       flashvars.com05 = "Comment posted.";
+       flashvars.com06 = "An error occured, please try again later.";
+       flashvars.com07 = "Processing, please wait";
+       flashvars.com08 = "Characters left: ";
+       flashvars.com09 = "This video has not been commented yet.";
+       flashvars.copycode = "copy code";
+               flashvars.latin = "1";
+/*     flashvars.detailslatin = ""; */
+       flashvars.embed = "%3Cobject+width%3D%22640%22+height%3D%22480%22%3E%3Cparam+name%3D%22movie%22+value%3D%22http%3A%2F%2Fwww.megaporn.com%2Fe%2F92307a2d8239362a40d18bebfa72e4e5%22%3E%3C%2Fparam%3E%3Cparam+name%3D%22allowFullScreen%22+value%3D%22true%22%3E%3C%2Fparam%3E%3Cembed+src%3D%22http%3A%2F%2Fwww.megaporn.com%2Fe%2F92307a2d8239362a40d18bebfa72e4e5%22+type%3D%22application%2Fx-shockwave-flash%22+allowfullscreen%3D%22true%22+width%3D%22640%22+height%3D%22480%22%3E%3C%2Fembed%3E%3C%2Fobject%3E";
+       flashvars.un = "71eef99c126511b92b770d654ecd25c8";
+       flashvars.k1 = "63233";
+       flashvars.k2 = "185149";
+       flashvars.s = "118";
+       flashvars.v = "E1LROW6E";
+       
+       
+       var params = {};
+       
+       params.scale = "noscale";
+       params.salign = "tl";
+       params.wmode = "transparent";
+       params.swliveconnect = "true";
+       params.allowscriptaccess = "always";
+       params.allowfullscreen = "true";
+       
+       var attributes = {};
+       
+       attributes.id = "mvplayer";
+       swfobject.embedSWF("http://wwwstatic.megaporn.com/video/mv_player.swf", "playercontainer", "800", "450", "8", false, flashvars, params, attributes);
+
+       
+       document.relatedloaded=false;
+       document.largeplayer=true;
+       function showrelated()
+       {
+         document.getElementById('embed_html').style.display='none';
+
+         if (document.relatedloaded == false)
+         {
+           document.getElementById('loading_ico').style.display = '';
+           document.getElementById('relatedfrm').submit();
+         }
+         else
+         {
+           document.getElementById('related_html').style.display = '';
+           document.getElementById('related_header').style.display = '';
+         }
+       }
+       function closerelated()
+       {
+         document.getElementById('related_html').style.display = 'none';
+         document.getElementById('related_header').style.display = 'none';
+       }
+       function adjustplayer()
+       {
+         if (document.largeplayer)
+         {
+           document.getElementById('mvplayer').width = '640';
+           document.getElementById('playerdiv').style.width = '640';
+           document.getElementById('playerdiv').style.height = '360';
+           document.getElementById('mvplayer').height = '360';
+           document.getElementById('playertd').height = '360';
+           document.getElementById('menutd1').width = '157';
+           document.getElementById('menutd2').width = '157';
+           document.getElementById('menutd3').width = '157';
+           document.getElementById('menutd4').width = '157';
+           document.getElementById('menudiv4').style.width = '157';
+           document.getElementById('menubg').background = 'http://wwwstatic.megaporn.com/video/mvgui/under_small.gif';
+               document.largeplayer=false;
+               
+               document.getElementById('playersizetxt').innerHTML = 'Big player';
+               
+           document.getElementById('playerbg').background = 'http://wwwstatic.megaporn.com/video/mvgui/small_vid_bg.gif';
+           
+         }
+         else
+         {
+           document.getElementById('mvplayer').width = '800';
+           document.getElementById('playerdiv').style.width = '800';
+           document.getElementById('playerdiv').style.height = '450';
+           document.getElementById('mvplayer').height = '450';
+           document.getElementById('playertd').height = '450';
+               document.getElementById('menutd1').width = '197';
+           document.getElementById('menutd2').width = '197';
+           document.getElementById('menutd3').width = '197';
+           document.getElementById('menutd4').width = '197';
+           document.getElementById('menudiv4').style.width = '197';
+           document.getElementById('menubg').background = 'http://wwwstatic.megaporn.com/video/mvgui/under_big.gif';
+               document.largeplayer=true;
+               
+               document.getElementById('playersizetxt').innerHTML = 'Small player';
+               
+           document.getElementById('playerbg').background = 'http://wwwstatic.megaporn.com/video/mvgui/big_vid_bg.gif';
+         }
+       }
+       
+       function embedvideo()
+       {
+         document.getElementById('related_html').style.display='none';
+         document.getElementById('related_header').style.display='none';
+         document.getElementById('embed_html').style.display='';
+       }
+
+       function embedclose()
+       {
+         document.getElementById('related_html').style.display='none';
+         document.getElementById('related_header').style.display='none';
+         document.getElementById('embed_html').style.display='none';
+       }
+
+       function resizing()
+       {
+          if (cinmode == 1)
+          {
+            resizecinema();
+          }
+       }
+
+       function playerout()
+       {
+         if (document.getElementById('mvplayer').hideNavigation)
+         {
+           document.getElementById('mvplayer').hideNavigation();
+         }
+       }
+       
+       </script>
+
+       </TD>
+</TR>
+</TABLE><TABLE width="100%" background="http://wwwstatic.megaporn.com/video/mvgui/vpage_bg.gif" cellpadding="0" cellspacing="0" style="margin-top:0px;">
+<TR>
+       <TD height="40" align="center" valign="top" style="padding-left:1px;">
+       
+
+       <TABLE background="http://wwwstatic.megaporn.com/video/mvgui/under_big.gif" cellpadding="0" cellspacing="0" id="menubg">
+       <TR>
+               <TD width="197" align="center"  valign="middle" height="33"  id="menutd1"> 
+               <TABLE cellpadding="0" cellspacing="0">
+               <TR>
+                       <TD height="25"><a href="javascript:adjustplayer();"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/under_ico1.gif" WIDTH="17" HEIGHT="12" BORDER="0" ALT=""></a>&nbsp;</TD>
+                       <TD><a href="javascript:adjustplayer();" style="font-size:12px; color:#000000; text-decoration:none; font-weight:normal;" id="playersizetxt">Small player</a></TD>
+               </TR>
+               </TABLE>
+               </TD>
+               <TD width="4" align="center" valign="middle"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/devider.gif" WIDTH="1" HEIGHT="19" BORDER="0" ALT=""></TD>
+               <TD width="197" align="center"  valign="middle" id="menutd2"> 
+               <TABLE cellpadding="0" cellspacing="0">
+               <TR>
+                       <TD height="25"  style="padding-top:2px;"><a href="javascript:embedvideo();"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/under_ico2.gif" WIDTH="14" HEIGHT="15" BORDER="0" ALT=""></a>&nbsp;</TD>
+                       <TD><a href="javascript:embedvideo();" style="font-size:12px; color:#000000; text-decoration:none; font-weight:normal;">Embed video</a></TD>
+               </TR>
+               </TABLE>
+               </TD>
+               <TD width="4" align="center"  valign="middle"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/devider.gif" WIDTH="1" HEIGHT="19" BORDER="0" ALT=""></TD>
+               <TD width="197" align="center"  valign="middle" id="menutd3"> 
+               <TABLE cellpadding="0" cellspacing="0">
+               <TR>
+                       <TD height="25" style="padding-top:2px;"><a href="javascript:showrelated();"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/under_ico3.gif" WIDTH="16" HEIGHT="14" BORDER="0" ALT=""></a>&nbsp;</TD>
+                       <TD><a href="javascript:showrelated();" style="font-size:12px; color:#000000; text-decoration:none; font-weight:normal;">Related videos</a></TD>
+               </TR>
+               </TABLE>
+               </TD>
+               <TD width="4" align="center"  valign="middle"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/devider.gif" WIDTH="1" HEIGHT="19" BORDER="0" ALT=""></TD>
+               <TD width="197" align="center"  valign="middle"  id="menutd4"> 
+               <div style="position:relative; width:197px; height:25px; z-index:10;"  id="menudiv4">
+               <TABLE cellpadding="0" cellspacing="0" id="cinemamenu_on">
+               <TR>
+                       <TD height="25"><a href="javascript:cinemamode(1);"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/under_ico4.gif"  style="" WIDTH="16" HEIGHT="12" BORDER="0" ALT=""></a>&nbsp;</TD>
+                       <TD><a href="javascript:cinemamode(1);" style="font-size:12px; color:#000000; text-decoration:none; font-weight:normal;">Cinema on</a></TD>
+               </TR>
+               </TABLE>
+               <TABLE cellpadding="0" cellspacing="0" id="cinemamenu_off" style="display:none;">
+               <TR>
+                       <TD height="25"><a href="javascript:cinemamode(0);"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/under_ico4b.gif"  style="" WIDTH="16" HEIGHT="12" BORDER="0" ALT=""></a>&nbsp;</TD>
+                       <TD><a href="javascript:cinemamode(0);" style="font-size:12px; color:#8F8F8F ; text-decoration:none; font-weight:normal;">Cinema off</a></TD>
+               </TR>
+               </TABLE>
+               </div>
+               </TD>
+       </TR>
+       </TABLE>
+
+       
+       <div style="position:relative; width:600px; height:60px; display:none;" id="loading_ico">
+       <div style="position:absolute; left:289px; top:25px; width:20px; height:20px;"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/loading.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT=""></div>
+       </div>
+
+
+       </TD>
+</TR>
+</TABLE>
+
+
+<div style="position:relative; width:797px; height:183px; background-image:url('http://wwwstatic.megaporn.com/video/mvgui/under_embed.gif'); display:none;" id="embed_html">
+
+
+
+
+<div style="position:absolute; left:30px; top:15px; width:400px; text-align:left; font-weight:bold; font-size:12px;">Set the size of the player:</div>
+
+
+<div style="position:absolute; left:30px; top:55px; width:400px; text-align:left; font-weight:bold; font-size:12px;">
+<TABLE cellpadding="0" cellspacing="0" style="font-size:12px;">
+<TR>
+       <TD>width:&nbsp;</TD>
+       <TD><input type="text" name="width" id="embed_width" style="width:50px;" class="text" value="640" onkeyup="prefill_width(this.value);" ></TD>
+       <TD>&nbsp;pixels</TD>
+</TR>
+<TR>
+       <TD colspan="3" height="25"></TD>
+</TR>
+<TR>
+       <TD>height:&nbsp;</TD>
+       <TD><input type="text" name="height" id="embed_height" style="width:50px;" class="text" value="360" onkeyup="prefill_height(this.value);"></TD>
+       <TD>&nbsp;pixels</TD>
+</TR>
+</TABLE>
+</div>
+
+
+<div style="position:absolute; left:30px; top:154px; width:400px; text-align:left; font-weight:bold; font-size:12px; color:#FD0819; display:none;" id="minimumwidthmsg">The minimum width is 440 pixels.</div>
+<div style="position:absolute; left:30px; top:154px; width:400px; text-align:left; font-weight:bold; font-size:12px; color:#FD0819; display:none;" id="minimumheightmsg">The minimum height is 330 pixels.</div>
+
+<div style="position:absolute; left:230px; top:55px; width:400px; text-align:left; font-weight:bold; font-size:12px;">
+<TABLE cellpadding="0" cellspacing="0" style="font-size:12px;">
+<TR>
+       <TD>size:&nbsp;</TD>
+       <TD>
+       <select onchange="selectchange();" id="sizeselectbox">
+       <option>Small</option>
+       <option selected>Normal</option>
+       <option>Large</option>
+       <option>XXL</option>
+       <option>Custom</option>
+       </select>
+       </TD>
+       <TD></TD>
+</TR>
+<TR>
+       <TD colspan="3" height="25"></TD>
+</TR>
+<TR>
+       <TD colspan="3" ><input type="checkbox" checked id="aspectratio"> <font id="aspectratiotxt">Keep aspect ratio</font></TD>
+</TR>
+</TABLE>
+</div>
+
+<script type="text/javascript">
+
+embedcloseimg = new Image(23,24);
+embedcloseimgo = new Image(23,24);
+embedcloseimgo.src = 'http://wwwstatic.megaporn.com/video/mvgui/embed_close_o.gif';
+
+</script>
+
+
+<div style="position:absolute; left:420px; top:15px; width:300px; text-align:left; font-weight:bold; font-size:12px;">Copy paste the following code:</div>
+
+<div style="position:absolute; left:430px; top:7px; width:360px; text-align:right; font-weight:bold; font-size:12px;"><a href="javascript:embedclose();"><IMG SRC="http://wwwstatic.megaporn.com/video/mvgui/embed_close.gif" WIDTH="23" HEIGHT="24" BORDER="0" ALT="" onmouseover="embedcloseimg.src=this.src; this.src=embedcloseimgo.src;" onmouseout="this.src=embedcloseimg.src;"></a></div>
+
+<div style="position:absolute; left:420px; top:52px; width:400px; text-align:left; font-weight:bold; font-size:12px;">
+<textarea style="width:350px; height:90px; border: 1px solid #A5ACB2;" id="embedcode" onclick="this.select();" readonly></textarea>
+</div>
+
+
+<div style="position:absolute; left:420px; top:154px; width:300px; text-align:left; font-weight:bold; font-size:12px;"><a href="javascript:previewplayer();" style="font-weight:bold; font-size:12px; text-decoration:none; color:#000000;">preview player</a></div>
+
+
+</div>
+
+<script type="text/javascript">
+
+customsetting=false;
+
+min_width = 440;
+min_height = 330;
+
+original_width = '416';
+original_height = '312';
+
+ewidth = 640;
+eheight = Math.floor((640/original_width)*original_height);
+
+custom_width = ewidth;
+custom_height = eheight;
+
+prefill_w = 640;
+prefill_h = eheight;
+
+document.getElementById('embed_width').value = ewidth;
+document.getElementById('embed_height').value = eheight;
+
+setembedcode(ewidth,eheight);
+
+
+
+
+function setplayersize(newwidth,newheight)
+{ 
+         if (newheight == 0)
+         {
+           ewidth = newwidth;
+               eheight = Math.floor((newwidth/original_width)*original_height);
+
+               if (eheight < min_height)
+               { 
+                 eheight = min_height;
+                 document.getElementById('aspectratio').disabled = true;
+                 document.getElementById('aspectratiotxt').color = '#757575';
+                 
+               }
+               else
+               {
+                 document.getElementById('aspectratio').disabled = false;
+                 document.getElementById('aspectratiotxt').color = '#000000';
+
+               }
+
+               document.getElementById('embed_width').value = ewidth;
+               document.getElementById('embed_height').value = eheight;
+               setembedcode(ewidth,eheight);
+         }
+         else if(newwidth == 0)
+         {
+           eheight = newheight;
+               
+               if (ewidth < min_width)
+               { 
+                 ewidth = min_width;
+                 document.getElementById('aspectratio').disabled = true;
+                 document.getElementById('aspectratiotxt').color = '#757575';
+               }
+               else
+               {
+                 document.getElementById('aspectratio').disabled = false;
+                 document.getElementById('aspectratiotxt').color = '#000000';
+               }
+
+               ewidth = Math.floor((newheight/original_height)*original_width);
+               document.getElementById('embed_width').value = ewidth;
+               document.getElementById('embed_height').value = eheight;
+               setembedcode(ewidth,eheight);
+         }
+         else
+         {
+           ewidth = newwidth;
+           eheight = newheight;
+           document.getElementById('embed_width').value = newwidth;
+               document.getElementById('embed_height').value = newheight;
+               setembedcode(ewidth,eheight); 
+         }
+         
+}
+
+
+function prefill_width(newwidth)
+{
+  if (isUnsignedInteger(newwidth))
+  {
+    if (newwidth < min_width)
+    { 
+         document.getElementById('minimumwidthmsg').style.display = '';
+         document.getElementById('embed_width').style.borderColor = '#FD0819';
+         
+    }
+       else
+       {
+         document.getElementById('embed_width').style.borderColor = '#A5ACB2';
+         document.getElementById('minimumwidthmsg').style.display = 'none';
+         prefill_w = newwidth;
+         
+         if (document.getElementById('aspectratio').checked == true)
+         {
+           setplayersize(newwidth,0);
+         }
+         else
+         {
+           setplayersize(newwidth,eheight);
+         }
+           
+         document.getElementById('sizeselectbox').selectedIndex = 4;
+         customsetting=true;
+         custom_width = ewidth;
+         custom_height = eheight;
+       }
+  }
+  else
+  {
+    if (newwidth !== '')
+    {
+         document.getElementById('embed_width').value = prefill_w;
+         
+      alert('Please enter a positive number.');
+         
+         document.getElementById('embed_width').style.borderColor = '#A5ACB2';
+         document.getElementById('minimumwidthmsg').style.display = 'none';
+    }
+  }
+}
+
+
+function prefill_height(newheight)
+{
+  if (isUnsignedInteger(newheight))
+  {
+    if (newheight < min_height)
+    { 
+         document.getElementById('minimumheightmsg').style.display = '';
+         document.getElementById('embed_height').style.borderColor = '#FD0819';
+         
+    }
+       else
+       {
+         document.getElementById('embed_height').style.borderColor = '#A5ACB2';
+         document.getElementById('minimumheightmsg').style.display = 'none';
+         prefill_w = newheight;
+
+         if (document.getElementById('aspectratio').checked == true)
+         {
+           setplayersize(0,newheight);
+         }
+         else
+         {
+           setplayersize(ewidth,newheight);
+         }
+         document.getElementById('sizeselectbox').selectedIndex = 4;
+         customsetting=true;
+         custom_width = ewidth;
+         custom_height = eheight;
+       }
+  }
+  else
+  {
+    if (newheight !== '')
+    {
+         document.getElementById('embed_height').value = prefill_h;
+      alert('Please enter a positive number.');
+         document.getElementById('embed_height').style.borderColor = '#A5ACB2';
+         document.getElementById('minimumheightmsg').style.display = 'none';
+    }
+  }
+}
+
+
+function isUnsignedInteger(s) 
+{
+  return (s.toString().search(/^[0-9]+$/) == 0);
+}
+
+
+
+function selectchange()
+{
+    document.getElementById('embed_width').style.borderColor = '#A5ACB2';
+    document.getElementById('minimumwidthmsg').style.display = 'none';
+    document.getElementById('embed_height').style.borderColor = '#A5ACB2';
+    document.getElementById('minimumheightmsg').style.display = 'none';
+
+       if (document.getElementById('sizeselectbox').selectedIndex == 0)
+       {
+         // small
+         setplayersize(450,0);
+       }
+       if (document.getElementById('sizeselectbox').selectedIndex == 1)
+       {
+         // normal
+         setplayersize(640,0); 
+       }
+       if (document.getElementById('sizeselectbox').selectedIndex == 2)
+       {
+         // large
+         setplayersize(800,0);
+
+       }
+       if (document.getElementById('sizeselectbox').selectedIndex == 3)
+       {
+         // XXL
+         setplayersize(1024,0);
+       }
+       if (document.getElementById('sizeselectbox').selectedIndex == 4)
+       {
+         // custom
+         if(customsetting)
+         {
+           setplayersize(custom_width,custom_height);
+         }
+       }
+}
+
+function previewplayer()
+{
+  
+  window.open('previewplayer/?v=E1LROW6E&width=' + ewidth + '&height=' + eheight + '&image=92307a2d8239362a40d18bebfa72e4e5',name,'width='+(ewidth)+',height='+(eheight)+',scrollbars=no,status=no,resizable=yes, toolbar=no'); 
+  
+}
+
+function setembedcode(cwidth,cheight)
+{
+  
+  document.getElementById('embedcode').value = '<object width="' + cwidth + '" height="' + cheight + '"><param name="movie" value="http://www.megaporn.com/e/E1LROW6E92307a2d8239362a40d18bebfa72e4e5"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megaporn.com/e/E1LROW6E92307a2d8239362a40d18bebfa72e4e5" type="application/x-shockwave-flash" allowfullscreen="true" width="' + cwidth + '" height="' + cheight + '"></embed></object>';
+  
+}
+
+
+
+</script>
+
+<div style="position:relative; padding-top:10px; width:901px; height:24px; display:none;" id="related_header">
+
+<div style="position:absolute; left:-4px; top:0px; width:452px; height:25px; background-image:url('http://wwwstatic.megaporn.com/video/mvgui/under_head.gif');">
+<div style="position:absolute; left:15px; top:4px; color:#FFFFFF; font-size:12px; width:450px; text-align:left;">Related videos</div>
+</div>
+
+<div style="position:absolute; left:453px; top:0px; width:452px; height:25px; background-image:url('http://wwwstatic.megaporn.com/video/mvgui/under_head.gif');">
+<div style="position:absolute; left:15px; top:4px; color:#FFFFFF; font-size:12px; width:450px; text-align:left;">Other videos from this user</div>
+<div style="position:absolute; left:0px; top:4px; width:438px; text-align:right;"><a href="javascript:closerelated();" style="color:#FFFFFF; font-size:12px; font-weight:bold; text-decoration:none;">Close</a></div>
+</div>
+
+</div>
+
+
+<div style="display:relative; padding-top:10px; width:901px; display:none;" id="related_html">&nbsp;</div>
+
+
+<div style="position:absolute; width:1px; height:1px;">
+
+<form method="POST" id="relatedfrm" action="relatedvideos.php" target="relatedframe">
+<input type="hidden" name="v" value="E1LROW6E">
+</form>
+<iframe src="" width="1" height="1" name="relatedframe" style="border:0;"></iframe>
+
+
+
+
+
+<div id="flash_cookie"></div>
+
+
+
+<script type="text/javascript">
+       var flashvars = {};
+       flashvars.u = "";
+       var params = {};
+       params.wmode = "transparent";
+       swfobject.embedSWF("http://wwwstatic.megaporn.com/video/cookie.swf", "flash_cookie", "1", "1", "0", false, flashvars, params);
+</script>
+
+
+<script type="text/javascript"><!--
+EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?
+EXb=EXs.colorDepth:EXb=EXs.pixelDepth;
+navigator.javaEnabled()==1?EXjv="y":EXjv="n";
+EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";
+location.protocol=="https:"?EXprot="https":EXprot="http";
+top.document.referrer?EXref=top.document.referrer:EXref=EXd.referrer;
+EXd.write("<img src="+EXprot+"://nht-2.extreme-dm.com",
+"/n3.g?login=mega04&amp;url="+escape(document.URL)+"&amp;pv=&amp;",
+"jv="+EXjv+"&amp;j=y&amp;srw="+EXw+"&amp;srb="+EXb+"&amp;",
+"l=http://www.megaporn.com/video/? height=1 width=1>");//-->
+</script><noscript><div id="nneXTReMe"><img height="1" width="1" alt=""
+src="http://nht-2.extreme-dm.com/n3.g?login=mega04&amp;url=nojs&amp;j=n&amp;jv=n&amp;pv=" />
+</div></noscript>
+
+
+<script type="text/javascript">
+
+var langImgs = new Array(19);
+var langOverImgs = new Array(19);
+var langArrowImgs = new Array(19);
+var locales = new Array(19);
+
+langImgs[0] = new Image(129, 25);
+langImgs[0].src="http://wwwstatic.megaporn.com/video/gui/language_object/en.gif";
+langOverImgs[0] = new Image(129, 25);
+langOverImgs[0].src="http://wwwstatic.megaporn.com/video/gui/language_object/en_o.gif";
+langImgs[1] = new Image(129, 21);
+langImgs[1].src="http://wwwstatic.megaporn.com/video/gui/language_object/de.gif";
+langOverImgs[1] = new Image(129, 21);
+langOverImgs[1].src="http://wwwstatic.megaporn.com/video/gui/language_object/de_o.gif";
+langImgs[2] = new Image(129, 21);
+langImgs[2].src="http://wwwstatic.megaporn.com/video/gui/language_object/fr.gif";
+langOverImgs[2] = new Image(129, 21);
+langOverImgs[2].src="http://wwwstatic.megaporn.com/video/gui/language_object/fr_o.gif";
+langImgs[3] = new Image(129, 21);
+langImgs[3].src="http://wwwstatic.megaporn.com/video/gui/language_object/es.gif";
+langOverImgs[3] = new Image(129, 21);
+langOverImgs[3].src="http://wwwstatic.megaporn.com/video/gui/language_object/es_o.gif";
+langImgs[4] = new Image(129, 21);
+langImgs[4].src="http://wwwstatic.megaporn.com/video/gui/language_object/pt.gif";
+langOverImgs[4] = new Image(129, 21);
+langOverImgs[4].src="http://wwwstatic.megaporn.com/video/gui/language_object/pt_o.gif";
+langImgs[5] = new Image(129, 21);
+langImgs[5].src="http://wwwstatic.megaporn.com/video/gui/language_object/nl.gif";
+langOverImgs[5] = new Image(129, 21);
+langOverImgs[5].src="http://wwwstatic.megaporn.com/video/gui/language_object/nl_o.gif";
+langImgs[6] = new Image(129, 21);
+langImgs[6].src="http://wwwstatic.megaporn.com/video/gui/language_object/it.gif";
+langOverImgs[6] = new Image(129, 21);
+langOverImgs[6].src="http://wwwstatic.megaporn.com/video/gui/language_object/it_o.gif";
+langImgs[7] = new Image(129, 21);
+langImgs[7].src="http://wwwstatic.megaporn.com/video/gui/language_object/cn.gif";
+langOverImgs[7] = new Image(129, 21);
+langOverImgs[7].src="http://wwwstatic.megaporn.com/video/gui/language_object/cn_o.gif";
+langImgs[8] = new Image(129, 21);
+langImgs[8].src="http://wwwstatic.megaporn.com/video/gui/language_object/ct.gif";
+langOverImgs[8] = new Image(129, 21);
+langOverImgs[8].src="http://wwwstatic.megaporn.com/video/gui/language_object/ct_o.gif";
+langImgs[9] = new Image(129, 21);
+langImgs[9].src="http://wwwstatic.megaporn.com/video/gui/language_object/jp.gif";
+langOverImgs[9] = new Image(129, 21);
+langOverImgs[9].src="http://wwwstatic.megaporn.com/video/gui/language_object/jp_o.gif";
+langImgs[10] = new Image(129, 21);
+langImgs[10].src="http://wwwstatic.megaporn.com/video/gui/language_object/kr.gif";
+langOverImgs[10] = new Image(129, 21);
+langOverImgs[10].src="http://wwwstatic.megaporn.com/video/gui/language_object/kr_o.gif";
+langImgs[11] = new Image(129, 21);
+langImgs[11].src="http://wwwstatic.megaporn.com/video/gui/language_object/ru.gif";
+langOverImgs[11] = new Image(129, 21);
+langOverImgs[11].src="http://wwwstatic.megaporn.com/video/gui/language_object/ru_o.gif";
+langImgs[12] = new Image(129, 21);
+langImgs[12].src="http://wwwstatic.megaporn.com/video/gui/language_object/fi.gif";
+langOverImgs[12] = new Image(129, 21);
+langOverImgs[12].src="http://wwwstatic.megaporn.com/video/gui/language_object/fi_o.gif";
+langImgs[13] = new Image(129, 21);
+langImgs[13].src="http://wwwstatic.megaporn.com/video/gui/language_object/se.gif";
+langOverImgs[13] = new Image(129, 21);
+langOverImgs[13].src="http://wwwstatic.megaporn.com/video/gui/language_object/se_o.gif";
+langImgs[14] = new Image(129, 21);
+langImgs[14].src="http://wwwstatic.megaporn.com/video/gui/language_object/dk.gif";
+langOverImgs[14] = new Image(129, 21);
+langOverImgs[14].src="http://wwwstatic.megaporn.com/video/gui/language_object/dk_o.gif";
+langImgs[15] = new Image(129, 21);
+langImgs[15].src="http://wwwstatic.megaporn.com/video/gui/language_object/tr.gif";
+langOverImgs[15] = new Image(129, 21);
+langOverImgs[15].src="http://wwwstatic.megaporn.com/video/gui/language_object/tr_o.gif";
+langImgs[16] = new Image(129, 21);
+langImgs[16].src="http://wwwstatic.megaporn.com/video/gui/language_object/sa.gif";
+langOverImgs[16] = new Image(129, 21);
+langOverImgs[16].src="http://wwwstatic.megaporn.com/video/gui/language_object/sa_o.gif";
+langImgs[17] = new Image(129, 21);
+langImgs[17].src="http://wwwstatic.megaporn.com/video/gui/language_object/vn.gif";
+langOverImgs[17] = new Image(129, 21);
+langOverImgs[17].src="http://wwwstatic.megaporn.com/video/gui/language_object/vn_o.gif";
+langImgs[18] = new Image(129, 21);
+langImgs[18].src="http://wwwstatic.megaporn.com/video/gui/language_object/pl.gif";
+langOverImgs[18] = new Image(129, 21);
+langOverImgs[18].src="http://wwwstatic.megaporn.com/video/gui/language_object/pl_o.gif";
+
+</script>
+
+
+
+</BODY>
+</HTML>
+
diff --git a/test/megaporn_test.rb b/test/megaporn_test.rb
new file mode 100644 (file)
index 0000000..f033d5b
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# 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/megaporn'
+
+
+class MegapornTest < Test::Unit::TestCase
+
+  def test_owns_megaporn_urls
+    assert(Megaporn.owns_url?('http://www.megaporn.com/video/?v=E1LROW6E'))
+  end
+
+  
+  def test_doesnt_own_infoq_urls
+    assert(!Megaporn.owns_url?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
+  end
+
+
+  def test_doesnt_own_redtube_urls
+    assert(!Megaporn.owns_url?('http://www.redtube.com/6807'))
+    assert(!Megaporn.owns_url?('www.redtube.com/6807'))
+    assert(!Megaporn.owns_url?('http://redtube.com/6807'))
+    assert(!Megaporn.owns_url?('redtube.com/6807'))
+  end
+
+  
+  def test_doesnt_own_efukt_urls
+    assert(!Megaporn.owns_url?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
+    assert(!Megaporn.owns_url?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
+  end  
+
+  
+  def test_decryption
+    mp = Megaporn.new(nil)
+    expected_result = '3de0ae51c90c7b100cc41e899648ac3c'
+    actual_result = mp.send('decrypt', 'becc1abe04b5ab8cb10dc7d29a497958', '49298', '63031')
+    assert_equal(expected_result, actual_result)
+  end
+
+
+  def test_parse_flash_variable
+    mp = Megaporn.new(nil)
+    page_data = nil
+    
+    File.open('test/fixtures/megaporn/E1LROW6E.html') do |f|
+      page_data = f.read
+    end
+
+    # Seed
+    expected_result = '71eef99c126511b92b770d654ecd25c8'
+    actual_result = mp.send('parse_flash_variable', page_data, 'un')
+    assert_equal(expected_result, actual_result)
+
+    # key1
+    expected_result = '63233'
+    actual_result = mp.send('parse_flash_variable', page_data, 'k1')
+    assert_equal(expected_result, actual_result)
+    
+    # key2
+    expected_result = '185149'
+    actual_result = mp.send('parse_flash_variable', page_data, 'k2')
+    assert_equal(expected_result, actual_result)
+
+    # Host suffix
+    expected_result = '118'
+    actual_result = mp.send('parse_flash_variable', page_data, 's')
+    assert_equal(expected_result, actual_result)
+  end
+    
+end
index a1a43905333707ec7e68294c9fb3212c705c10be..9312ab839bc43820d2d78458b8df6ac538af67f7 100644 (file)
@@ -20,6 +20,7 @@ require 'test/efukt_test'
 require 'test/fuckedtube_test'
 require 'test/howcast_test'
 require 'test/infoq_test'
+require 'test/megaporn_test'
 require 'test/redtube_test'
 require 'test/veoh_test'
 require 'test/uri_utilities_test'