|
这个插件是对多页中的第一个页面进行了分析,获取到分页总数,然后生成了分页让采集器下载,涉及的代码为
public List<string> GetPagesUrl(int level, string pageurl, string html, string pagesStyle, string pagesCombine)
{
List<string> urls = new List<string>();
//"show": 127}, http://comment5.news.sina.com.cn ... list=all&sort=0,
http://news.sina.com.cn/c/2012-04-26/061224331859.shtml
if (level == 1 && pageurl.Contains("page=1&"))
{
string sign="show\": ";
int pos = html.IndexOf(sign);
if (pos > 0)
{
int pos2 = html.IndexOf("}", pos);
if (pos2 > 0)
{
int count = int.Parse(html.Substring(pos + sign.Length, pos2 - pos - sign.Length));
count = (int)Math.Ceiling((double)count / 20);
for (int i = 2; i < count + 1; i++)
{
urls.Add(pageurl.Replace("page=1", "page=" + i.ToString()));
}
}
}
}
return urls;
}
public bool UseGetPagesUrl
{
get { return true; }
}
附件下载地址和说明参考地址:http://board.locoy.com/?post=124 |
|