下载基于Content-Type JavaScript Casperjs的链接

时间:2016-01-31 15:50:37

标签: javascript download casperjs content-type

我是CasperJS的初学程序员,我正在编写一个收集网站上每个链接的爬虫,我希望根据内容类型下载。

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="InternalClass.cs" company="TestCompany">
//   MS-PL
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleApplication10
{
    /// <summary>
    /// Test internal class.
    /// </summary>
    internal class InternalClass
    {
        /// <summary>
        /// Gets or sets a value indicating whether the property one.
        /// </summary>
        internal bool Property1 { get; set; }

        /// <summary>
        /// Gets the property two.
        /// </summary>
        internal int Property2 { get; private set; }
    }
}

1 个答案:

答案 0 :(得分:0)

casper.on("resource.received", function(response){
   "use strict";
    resourcesRec.push(response);
    var file = response.url.replace(/^.*[\\\/]/, '');
    casper.download(response.url,file);
});