static crawlLinks(url) {
    debug(url);
    // Create the DB connection
    Db.connect()
      // Create the home category in the DB
      .then(() => {
        const category = {
          name: 'home',
          type: PageType.LIST,
          layout: 'GENERAL_LIST',
          path: '/',
          url,
        };
        new Legislation(category).save().then(() => 0);
      })
      // Start crawling the home
      .then(() => {
        SpiderStatus.start(url);
        return Crawl.page(url);
      })
      // Count the legislations created
      // .then(() => {
      //   const quantity = Legislation.count();
      //   debug(quantity);
      //   SpiderStatus.finishAll(quantity);
      //   return quantity;
      // })
      // // Get all legislations from the DB
      // .then(() => Legislation.list({ type: 'LEGISLATION', crawl: 'ART' }))
      // // Scrap the legislations
      // .then(legislations => Scrap.legislations(legislations, global.parallel))

      // Close the DB connection
      .then(() => {
        Db.close();
      })
      .catch((err) => {
        Db.close();
        error('spider', 'general error', err);
      });
  }
/**
   * Capture all links and it's details and content from a single URL
   * @method crawlLinks
   * @static
   */
Capture all links and it's details and content from a single URL
@method crawlLinks
@static
Capture all links and it ' s details and content from a single URL @method crawlLinks @static
static crawlLinks(url) {
    debug(url);
    Db.connect()
      .then(() => {
        const category = {
          name: 'home',
          type: PageType.LIST,
          layout: 'GENERAL_LIST',
          path: '/',
          url,
        };
        new Legislation(category).save().then(() => 0);
      })
      .then(() => {
        SpiderStatus.start(url);
        return Crawl.page(url);
      })
      .then(() => {
        Db.close();
      })
      .catch((err) => {
        Db.close();
        error('spider', 'general error', err);
      });
  }
static crawlLinks ( url ) { debug ( url ) ; Db . connect ( ) . then ( ( ) => { const category = { name : 'home' , type : PageType . LIST , layout : 'GENERAL_LIST' , path : '/' , url , } ; new Legislation ( category ) . save ( ) . then ( ( ) => 0 ) ; } ) . then ( ( ) => { SpiderStatus . start ( url ) ; return Crawl . page ( url ) ; } ) . then ( ( ) => { Db . close ( ) ; } ) . catch ( ( err ) => { Db . close ( ) ; error ( 'spider' , 'general error' , err ) ; } ) ; }
Capture all links and it's details and content from a single URL
 @method crawlLinks
 @static
Capture all links and it ' s details and content from a single URL @method crawlLinks @static
// Create the DB connection // Create the home category in the DB // Start crawling the home // Count the legislations created // .then(() => { //   const quantity = Legislation.count(); //   debug(quantity); //   SpiderStatus.finishAll(quantity); //   return quantity; // }) // // Get all legislations from the DB // .then(() => Legislation.list({ type: 'LEGISLATION', crawl: 'ART' })) // // Scrap the legislations // .then(legislations => Scrap.legislations(legislations, global.parallel)) // Close the DB connection