Skip to content

Commit

Permalink
Merge pull request #274 from yujiosaka/mark-skipped-request
Browse files Browse the repository at this point in the history
fix(hccrawler): allow-low-level-access
  • Loading branch information
yujiosaka authored Jun 10, 2018
2 parents 159402c + a0b042e commit 4f5bac5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Set `previousUrl` to `onSuccess` argument.
- Set `options`, `depth`, `previousUrl` to errors.

### Fixed

- Fix a bug of not marking skipped requests correctly.
- Fix `requestfinished` event's argument as described in the [API reference](https://github.com/yujiosaka/headless-chrome-crawler/blob/master/docs/API.md).

## [1.6.0] - 2018-05-14

### Added
Expand Down
8 changes: 4 additions & 4 deletions lib/hccrawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,14 @@ class HCCrawler extends EventEmitter {
try {
const res = await crawler.crawl();
await crawler.close();
this.emit(HCCrawler.Events.RequestFinished, options);
const requested = await this._checkRequestedRedirect(options, res.response);
if (requested) return [];
extend(res, { options, depth, previousUrl });
this.emit(HCCrawler.Events.RequestFinished, res);
await this._success(res);
await this._markRequested(options);
await this._markRequestedRedirects(options, res.redirectChain, res.response);
if (requested) return [];
extend(res, { options, depth, previousUrl });
this._exportLine(res);
await this._success(res);
return res.links;
} catch (error) {
await crawler.close();
Expand Down

0 comments on commit 4f5bac5

Please sign in to comment.