diff --git a/README.md b/README.md index dc13cd9..8e29fdd 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ scraper.start(["telivision", "mobiles"]); // It will scrape only specified categ ### scraper.stats(showAsNumbers?=false) -This method will show the stasts of scraper. By default stats will come as numerals like (3.1k, 1.45GB) +This method will show the stats of scraper. By default stats will come as numerals like (3.1k, 1.45GB) - `showAsNumbers?` {boolean} Stats will return as number instead of numerals. @@ -182,7 +182,7 @@ scraper.on("data", (data) => { ### events: 'categoryCompleted' -Emitted when all products scraped by category. +Emitted when all products scraped for the category. **Example** @@ -195,7 +195,7 @@ scraper.on("categoryCompleted", (completedCategoryInfo) => { ### events: 'finished' -Emitted when scraper finished +Emitted when scraper finished. **Example** @@ -234,7 +234,7 @@ scraper.on("retry", (retryInfo) => { ### events: 'retryHalted' -Emitted if any retries failed 10 times. +Emitted if any retries failed for 10 times. **Example** diff --git a/docs/classes/index.flipkartscraper.html b/docs/classes/index.flipkartscraper.html index 232ef89..c6ce033 100644 --- a/docs/classes/index.flipkartscraper.html +++ b/docs/classes/index.flipkartscraper.html @@ -3,8 +3,8 @@ - FlipkartScraper | flipkart-scraper - v1.1.0 - + FlipkartScraper | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
  • Preparing search index...
  • The search index is not available
  • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • index @@ -118,7 +118,7 @@

      constructor

    • @@ -157,7 +157,7 @@

      start

    • Parameters

      @@ -182,7 +182,7 @@

      stats

    • Parameters

      diff --git a/docs/enums/enums.scraperstatus.html b/docs/enums/enums.scraperstatus.html index f948c4d..a612dc5 100644 --- a/docs/enums/enums.scraperstatus.html +++ b/docs/enums/enums.scraperstatus.html @@ -3,8 +3,8 @@ - ScraperStatus | flipkart-scraper - v1.1.0 - + ScraperStatus | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • enums @@ -91,7 +91,7 @@

      FINISHED

      FINISHED: = "finished"
      @@ -101,7 +101,7 @@

      INPROGRESS

      INPROGRESS: = "inprogress"
      @@ -111,7 +111,7 @@

      PAUSED

      PAUSED: = "paused"
      @@ -121,7 +121,7 @@

      READY

      READY: = "ready"
      @@ -131,7 +131,7 @@

      STOPPED

      STOPPED: = "stopped"
      diff --git a/docs/index.html b/docs/index.html index d702c6c..ede8b0a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,8 +3,8 @@ - flipkart-scraper - v1.1.0 - + flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -48,7 +48,7 @@
    -

    flipkart-scraper - v1.1.0

    +

    flipkart-scraper - v2.0.0

    @@ -144,7 +144,7 @@

    scraper.start([categoriesToScrape])

    scraper.stats(showAsNumbers?=false)

    -

    This method will show the stasts of scraper. By default stats will come as numerals like (3.1k, 1.45GB)

    +

    This method will show the stats of scraper. By default stats will come as numerals like (3.1k, 1.45GB)

    • showAsNumbers? {boolean} Stats will return as number instead of numerals.
    @@ -223,7 +223,7 @@

    events: 'data'

    events: 'categoryCompleted'

    -

    Emitted when all products scraped by category.

    +

    Emitted when all products scraped for the category.

    Example

    // 'categoryCompleted' event handler
     scraper.on("categoryCompleted", (completedCategoryInfo) => {
    @@ -233,7 +233,7 @@ 

    events: 'categoryCompleted'

    events: 'finished'

    -

    Emitted when scraper finished

    +

    Emitted when scraper finished.

    Example

    // 'finished' event handler
     scraper.on("finished", (info) => {
    @@ -263,7 +263,7 @@ 

    events: 'retry'

    events: 'retryHalted'

    -

    Emitted if any retries failed 10 times.

    +

    Emitted if any retries failed for 10 times.

    Example

    // Triggerd when retry failed 10 times
     scraper.on("retryHalted", (retryHaltInfo) => {
    diff --git a/docs/interfaces/interfaces.categoryinfo.html b/docs/interfaces/interfaces.categoryinfo.html
    index babdb0e..bbf108e 100644
    --- a/docs/interfaces/interfaces.categoryinfo.html
    +++ b/docs/interfaces/interfaces.categoryinfo.html
    @@ -3,8 +3,8 @@
     
     	
     	
    -	CategoryInfo | flipkart-scraper - v1.1.0
    -	
    +	CategoryInfo | flipkart-scraper - v2.0.0
    +	
     	
     	
     	
    @@ -23,7 +23,7 @@
     						
  • Preparing search index...
  • The search index is not available
  • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • interfaces @@ -96,7 +96,7 @@

      message

      message: string
      @@ -106,7 +106,7 @@

      totalRequest

      totalRequest: number
      diff --git a/docs/interfaces/interfaces.pendingcategoryinfo.html b/docs/interfaces/interfaces.pendingcategoryinfo.html index 130bc73..1218628 100644 --- a/docs/interfaces/interfaces.pendingcategoryinfo.html +++ b/docs/interfaces/interfaces.pendingcategoryinfo.html @@ -3,8 +3,8 @@ - PendingCategoryInfo | flipkart-scraper - v1.1.0 - + PendingCategoryInfo | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • interfaces @@ -97,7 +97,7 @@

      Optional concurrency

      concurrency: number
      @@ -112,7 +112,7 @@

      Optional maxPage

      maxPage: number
      @@ -127,7 +127,7 @@

      Optional maxRequest

      maxRequest: number
      diff --git a/docs/interfaces/interfaces.statsdata.html b/docs/interfaces/interfaces.statsdata.html index d59219b..9d15598 100644 --- a/docs/interfaces/interfaces.statsdata.html +++ b/docs/interfaces/interfaces.statsdata.html @@ -3,8 +3,8 @@ - StatsData | flipkart-scraper - v1.1.0 - + StatsData | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -48,7 +48,7 @@
    -

    flipkart-scraper - v1.1.0

    +

    flipkart-scraper - v2.0.0

    diff --git a/docs/modules/enums.html b/docs/modules/enums.html index 313e8c8..0c736d1 100644 --- a/docs/modules/enums.html +++ b/docs/modules/enums.html @@ -3,8 +3,8 @@ - enums | flipkart-scraper - v1.1.0 - + enums | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
  • Preparing search index...
  • The search index is not available
  • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • enums diff --git a/docs/modules/index.html b/docs/modules/index.html index 89e330c..88a70e5 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -3,8 +3,8 @@ - index | flipkart-scraper - v1.1.0 - + index | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • interfaces diff --git a/docs/modules/typealiases.html b/docs/modules/typealiases.html index a21c4c9..d6a2429 100644 --- a/docs/modules/typealiases.html +++ b/docs/modules/typealiases.html @@ -3,8 +3,8 @@ - typeAliases | flipkart-scraper - v1.1.0 - + typeAliases | flipkart-scraper - v2.0.0 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    @@ -50,7 +50,7 @@
    • - flipkart-scraper - v1.1.0 + flipkart-scraper - v2.0.0
    • typeAliases @@ -84,7 +84,7 @@

      StringOrNumber

      StringOrNumber: string | number
      diff --git a/examples/basic.js b/examples/basic.js index e461f28..090c3d4 100644 --- a/examples/basic.js +++ b/examples/basic.js @@ -21,10 +21,22 @@ scraper.on('response', response => { scraper.on('categoryCompleted', info => { console.log('Completed:', info) }) +scraper.on('retry', retryInfo => { + console.log('Retry:', retryInfo) +}) +scraper.on('retryHalted', retryHaltedInfo => { + console.log('Retry Halted:', retryHaltedInfo) +}) scraper.on('finished', info => { console.log('Scraping finished:', info) }) scraper.on('error', error => { console.error(error); }) -scraper.start().catch(err => {}) \ No newline at end of file + +scraper.start().catch(console.error) + +// To get stats of the scraper +setInterval(() => { + console.log(JSON.stringify(scraper.stats(), null, 2)) +}, 1000) diff --git a/examples/specificCategories.js b/examples/specificCategories.js index 3a74714..122596b 100644 --- a/examples/specificCategories.js +++ b/examples/specificCategories.js @@ -25,4 +25,4 @@ scraper.on('error', error => { console.error(error); }) -scraper.start(['mobiles', 'televisions']).catch(err => {}) \ No newline at end of file +scraper.start(['mobiles', 'televisions']).catch(console.error) diff --git a/examples/withOptions.js b/examples/withOptions.js index 8419ceb..89fba2c 100644 --- a/examples/withOptions.js +++ b/examples/withOptions.js @@ -31,4 +31,4 @@ scraper.on('error', error => { console.error(error); }) -scraper.start().catch(err => {}) \ No newline at end of file +scraper.start().catch(console.error) diff --git a/package.json b/package.json index d05886c..6d1c0af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flipkart-scraper", - "version": "1.1.0", + "version": "2.0.0", "main": "dist/index.js", "repository": "https://github.com/hi-imcodeman/flipkart-scraper.git", "author": "Asraf Ali ",