用ss6(supesite6.0beta)抓华师大在线的新闻时遇到一点问题,就是获取不到完整的页面代码。
华师大在线采用shtml,不知道是否与此有关,ss测试程序只能抓到菜单部分,下面就没有了。后来只好自己写个页面来替它抓,然后再提供给ss来分析。
代理页面代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(Request.QueryString["url"]))
{
string url = Request.QueryString["url"];
Encoding codetype = Encoding.UTF8;
if (!string.IsNullOrEmpty(Request.QueryString["code"]))
{
codetype = Encoding.GetEncoding(Request.QueryString["code"]); ;
}
string html=GetHtmlCode(url, 8000, 0, codetype);
Page.Response.Write(html);
}
else
TextBox1.Text = "未输入请求链接";
}
//下面是抄的
private string GetHtmlCode(string strUrl, int timeout, int enterType, Encoding EnCodeType)
{
string strResult;
try
{
HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(strUrl);
myReq.Timeout = timeout;
HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse();
Stream myStream = HttpWResp.GetResponseStream();
StreamReader sr = new StreamReader(myStream, EnCodeType);
StringBuilder strBuilder = new StringBuilder();
while (-1 != sr.Peek())
{
strBuilder.Append(sr.ReadLine());
if (enterType == 1)
{
strBuilder.Append("\r\n");
}
}
strResult = strBuilder.ToString();
}
catch (Exception err)
{
strResult = "请求错误:" + err.Message;
}
return strResult;
}
下面是ss6采集器配置文件:
# SupeSite Dump
# Version: SupeSite 6.0beta1
# Time: 2008-01-11 11:41:43
# From: 武汉七校新闻网 ()
#
# This file was BASE64 encoded
#
# SupeSite: http://www.supesite.com
# Please visit our website for latest news about SupeSite
# ——————————————————–
YTo1MDp7czo3OiJyb2JvdGlkIjtzOjI6IjExIjtzOjQ6Im5hbW
UiO3M6MTI6IuWNjuW4iOimgemXuyI7czozOiJ1aWQiO3M6MToi
MSI7czo4OiJkYXRlbGluZSI7czoxMDoiMTIwMDAyMjExOCI7cz
o4OiJsYXN0dGltZSI7czoxMDoiMTIwMDAyMTkwNyI7czoxMToi
aW1wb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