Is there a way to set up a system there extracts SWFs from a webpage automatically?

It would be something were you have a text box and you enter the URL of a page into it. The page contains a SWF. The program goes looking in that page and finds all the SWF files and brings a link of each one onto a page you select the SWF that you want and it uploads it to a server?

I know this is a lot to ask and it is complicated but i wanted to know if it is possible and is so how would you go about doing it?

would it be hard? I am not the one who will be programming this i am just researching it.

If you have enough experience in using (AJAX+RegularExpression), then i can say—it's not that hard to handle this application.

The only thing that you need to worry about is the payload that will be sent back to your site for stripping.

Especially when you are sending out those request under slow connection and a site who's pages— are weighing 500k-up -

this may take some time for the page to complete its download...

On which side do you mean it will be slow because this will only be used by 1 maybe 2 people at a time on my website.

Here's a bit of example of extracting attribute values of a given tags.

This demo comes in 3 separated files named as (main.html, swf.html, cross-ajax.js).

Here's is the code, for all the files listed above:

main.html

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml-stylesheet type="text/css" href="#css21" media="screen"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html id="xhtml10S" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Window-Target" content="_top" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Free Live Help!</title>
<style id="css21" type="text/css" media="screen">
/* <![CDATA[ */


/* ]]> */
</style> 
<script type="text/javascript" src="cross-ajax.js"></script>

</head>
<body>
<div id="request">

</div>
</body>
</html>

swf.html

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml-stylesheet type="text/css" href="#css21" media="screen"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="xhtml10S" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Window-target" content="_top" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Free Live Help!</title>
<style id="css21" type="text/css" media="screen">
/* <![CDATA[ */

/* ]]> */
</style> 
</head>
<body>
<div id="flash1">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="240" id="Yourfilename" align="center">
<param name="movie" value="filename.swf" /> <param name="quality" value="high" /> 
<param name="bgcolor" value="#333399" /> 
<embed src="filename.swf" quality="high" bgcolor="#333399" width="320" height="240" name="filename" align="center" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed> 
</object>
</div>
<div id="flash2">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="320" height="240" id="filename2" align="center">
<param name="movie" value="filename2.swf" /> <param name="quality" value="high" /> 
<param name="bgcolor" value="#333399" /> 
<embed src="filename2.swf" quality="high" bgcolor="#333399" width="320" height="240" name="filename" align="center" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed> 
</object>
</div>
</body>
</html>

cross-ajax.js

var xmlHttp;
var asynchronous = true;
var method = "GET"; // Set the request type.

var handleRequest = function() {
   var count = 0; 
   var div = (( document.getElementById ) ? document.getElementById("request") : document.all.request );
   div.innerHTML = "";
   var $xml = xmlHttp.responseXML;
   var $txt = xmlHttp.responseText;
   if (( xmlHttp.readyState === 4 ) || ( xmlHttp.readyState === "complete" )) {
      // if ( xmlHttp.status === 200 ) {
      var fsize = ( String( parseFloat( $txt.length / 1020 )).match( /\d+\.\d{2}/g)[0] + "kb" );
      var swf;
      try { 
      swf = $xml.getElementsByTagName("embed");
      } catch( t ) { 
         try {
         swf = $xml.documentElement.all.tags("embed");
         } catch( tn ) {
         alert( "These feature is not supported in your browser.\nPlease upgrade first before viewing back to this site." );
         return false;
         }
      } div.innerHTML += "<p>Total file size: " + fsize + "<br />The total number of file found: ";
      for ( var x = 0; x < swf.length; x++ ) {
         if ( swf[ x ].hasAttribute( "src" ) ) {
         div.innerHTML += "<br />&#8212;SWF File#" + ( count += 1 ) + "<span style=\"color : #190; letter-spacing : 3px; display : block; border-top : 1px solid #000; padding-top : 1em;\">&lt; " + swf[ x ].getAttributeNode( "src" ).nodeValue + " &gt;</span>";
         continue;
         }
      } div.innerHTML += "</p>";
      // }
      }
   };

var sendRequest = function( url ) {
   try {
      if ( "XMLHttpRequest" in window ) {
      xmlHttp = new XMLHttpRequest(); 
      } else if ( "ActiveXObject" in window ) {
      var client = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ];
         try {
            for ( var i = 0; i < client.length; i++ ) {
            xmlHttp = new ActiveXObject( client[ i ] ); 
            }
         } catch( er ) { }
      }  
   } catch( e ) {
      if ( "createRequest" in window ) {
      xmlHttp = window.createRequest();
      } xmlHttp = null;
   } if ( xmlHttp !== null ) {
   (( "overrideMimeType" in xmlHttp ) ? xmlHttp.overrideMimeType("text/xml") : xmlHttp );
   xmlHttp.onreadystatechange = handleRequest;
   xmlHttp.open( method, encodeURIComponent( url ), asynchronous );
   (( method === "POST" && "setRequestHeader" in xmlHttp ) ? xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") : xmlHttp );
   xmlHttp.send( null );
   return true;
   } alert( "Your browser does not handle AJAX Request!" );
};

window.onload = function() { sendRequest("swf.html") };

make sure that all 3 files are on the same directory when you run this application.

Just open main.html and it will automatically strip down all the links containing swf files.

Hope it helps...
essential

This article has been dead for over six months. Start a new discussion instead.