visit
Visits a URL using phantomjs, loads the page, runs the CJS scripts and collects the results.
Last updated 4 years ago by tobie .
Apache License, Version 2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install visit 
SYNC missed versions from official npm registry.

Visit

visit is a PhantomJS-based node module.

It's designed to visits one or multiple urls, runs a CommonJS-aware script in the context of the page once the page is loaded, grab whatever response it gets back through the window.callPhantom() method and parse it as JSON.

visit's goal is just to be a robust wrapper around PhantomJS, focused on a single task: get specific data out of a publicly available Web page.

API

visit(url, script[, options], callback)

Visits url, runs script onload (note script can import other CJS modules) and call callback upon completition with the object passed from script as second argument.

options is… optional. It accepts the following values:

  • timeout (int): the length, in ms before a request is killed. Defaults to none.
  • attempts (int): number of attempts at visiting the page before reporting an error (note this uses an exponential backoff). Defaults to 1.
  • delay (int): time in ms before the second attempt, default to 0 ms.
  • confing (str): Path to the PhantomJS JSON config file. Optional.

visitPages(urls, script[, options], callback)

Sequenctially visits every url in the urls array, run script for each page load (note script can import other CJS modules). Passes the output of visiting each url as an array to the callback.

Options are the same as for visit.

Current Tags

  • 0.4.0                                ...           latest (4 years ago)

6 Versions

  • 0.4.0                                ...           4 years ago
  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |