本文介绍了从网页下载所有swf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我正在处理一项任务,我必须下载在网页中运行的所有flash对象swf和flv文件。我不知道找到.swf文件的来源,因为大多数swf文件来自其他服务器。我想找出somw方法来找到当前正在运行的.swf的源/ url。请建议我一些方法。

我有两个想法,但目前没有成功实施它们。
1.使用WebBrowser类并以某种方式找到swf的URL。
2.使用Pcap获取所有http数据包,解码后,有些人试图找到网址。

任何其他选项或一些简单的方法来实现上述选项都会受到高度评价。

最好的问候

卡卡

Hi!

I am working on a task in which I have to download all flash objects swf and flv files running in web page. I have got no clue to find he source of .swf file, as mostly swf files comes from other servers. I want to find out somw way to find the source / url of .swf currently running. Kindly suggest me some way.

I have 2 ideas in mind, but currently unsuccessful in implementing them

1. Using WebBrowser class and somehow find url of swf.
2. Using Pcap to fetch all http packets and after decoding, some how try to find url coming.

Any other option or some simple way to implement above option would be highly appretiated.

Best Regards

Kaka

推荐答案

系统;

使用

System.Net;

使用

System.IO;

namespace

namespace

ParseHtmlSource

{

ParseHtmlSource

{

class 程序

class Program

{

静态 void Main( string [] args)

{

static void Main(string[] args)

{

string url = " http://www.adobe.com/" ;

string url = "http://www.adobe.com/";

 

HttpWebRequest myWebRequest =( HttpWebRequest HttpWebRequest 。创建(url);

myWebRequest.Method =

HttpWebRequest myWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);

myWebRequest.Method =

" GET" ;

"GET";

 

//请求url

HttpWebResponse myWebResponse =( HttpWebResponse )myWebRequest.GetResponse();

HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse();

 

StreamReader myWebSource = new StreamReader (myWebResponse.GetResponseStream());

StreamReader myWebSource = new StreamReader(myWebResponse.GetResponseStream());

 

string htmlSource = myWebSource.ReadToEnd();

string htmlSource = myWebSource.ReadToEnd();

 

int swfIndex = 0;

int swfIndex = 0;

 

//解析html源代码。 swf

while (swfIndex!= htmlSource.Length&&

-1!=(swfIndex = htmlSource.IndexOf(

while (swfIndex != htmlSource.Length &&

-1 != (swfIndex = htmlSource.IndexOf(

" .swf \"" ,swfIndex + 1)))

{

".swf\"",swfIndex+1)))

{

int 是ginIndex = htmlSource.LastIndexOf( '" ;' ,swfIndex);;

int beginIndex = htmlSource.LastIndexOf('"', swfIndex);;

 

int endIndex = htmlSource.IndexOf( '"' ,swfIndex);

int endIndex = htmlSource.IndexOf('"', swfIndex);

 

控制台 。WriteLine(htmlSource.Substring(beginIndex,endIndex-beginIndex + 1));

}

Console.WriteLine(htmlSource.Substring(beginIndex,endIndex-beginIndex+1));

}

swfIndex = 0;

swfIndex = 0;

while (swfIndex!= htmlSource.Length&&

-1!=(swfIndex = htmlSource.IndexOf(

while (swfIndex != htmlSource.Length &&

-1 != (swfIndex = htmlSource.IndexOf(

" .swf'" ,swfIndex + 1)))

{

".swf'", swfIndex + 1)))

{

int endIndex = htmlSource.IndexOf( "'" ,swfIndex);

int endIndex = htmlSource.IndexOf("'", swfIndex);

 

int beginIndex = htmlSource.LastIndexOf ( "'" ,swfIndex);

int beginIndex = htmlSource.LastIndexOf("'", swfIndex);

 

控制台 。WriteLine(htmlSource.Substring(beginIndex,endIndex - beginIndex + 1));

}

Console.WriteLine(htmlSource.Substring(beginIndex, endIndex - beginIndex + 1));

}

myWebResponse.Close();

myWebResponse.Close();

}

}

}


这篇关于从网页下载所有swf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 18:22