UNPKG

1.91 kBJavaScriptView Raw
1function Plugin() {
2
3
4}
5
6/**
7 * Function triggers when an Http error occurs for request made by the crawler
8 *
9 * @param the http error
10 * @param the http resource object (contains the uri of the resource)
11 * @param callback(error)
12 */
13Plugin.prototype.error = function (error, result, callback) {
14
15}
16
17/**
18 * Function triggers when an html resource is crawled
19 *
20 * @param result : the result of the resource crawl
21 * @param the jquery like object for accessing to the HTML tags. Null is the resource
22 * is not an HTML
23 * @param callback(error)
24 */
25Plugin.prototype.crawl = function(result, $, callback) {
26
27}
28
29/**
30 * Function triggers when the crawler found a link on a page
31 *
32 * @param the page url that contains the link
33 * @param the link found in the page
34 * @param the link anchor text
35 * @param true if the link is on follow
36 * @param callback(error)
37 */
38Plugin.prototype.crawlLink = function(page, link, anchor, isDoFollow, callback) {
39
40
41}
42
43/**
44 * Function triggers when the crawler found an image on a page
45 *
46 * @param the page url that contains the image
47 * @param the image link found in the page
48 * @param the image alt
49 * @param callback(error)
50 *
51 */
52Plugin.prototype.crawlImage = function(page, link, alt, callback) {
53
54
55}
56
57/**
58 * Function triggers when the crawler found an HTTP redirect
59 * @param the from url
60 * @param the to url
61 * @param the redirect code (301, 302, ...)
62 * @param callback(error)
63 *
64 */
65Plugin.prototype.crawlRedirect = function(from, to, statusCode, callback) {
66
67}
68
69/**
70 * Function triggers when a link is not crawled (depending on the crawler setting)
71 *
72 * @param the page url that contains the link
73 * @param the link found in the page
74 * @param the link anchor text
75 * @param true if the link is on follow
76 * @param callback(error)
77 *
78 */
79Plugin.prototype.unCrawl = function(page, link, anchor, isDoFollow, endCallback) {
80
81}
82
83module.exports.Plugin = Plugin;