Reference Source
import InjectManager from 'squidwarc/lib/injectManager/index.js'
public class | source

InjectManager

Manages the JavaScript that is injected into the page

Static Method Summary

Static Public Methods
public static

getCollectInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject

Receive param object for JS injected into every frame of the page crawled that sets up out link collection

public static

getCrawlInjects(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject

JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap, JS that scrolls the page automatically and JS that sets up out link collection

public static

getCrawlInjectsNoScroll(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject

Receive param object for JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap and JS that sets up out link collection

public static

getNoNaughtyJsInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject

Receive param object for JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap

public static

getScollOnLoadInject(onNewDocument: boolean): {"key": *}

Receive param object for JS injected into every frame of the page crawled that scrolls the page once the load event has fired

public static

getScrollInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject

Receive param object for JS injected into every frame of the page crawled that scrolls the page automatically

public static

Receive the raw function that is used to collect outlinks from the pre-injected script collect for use with Runtime.evaluate

public static

rawNoNaughty(): function(): void

Receive the raw function that helps ensure that the pages JS can not be naughty for use with Runtime.evaluate

public static

Receive the raw function that is used to collect outlines from each of the pages frames.

public static

Receive the raw scroll page function for use with Runtime.evaluate

Static Public Methods

public static getCollectInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject source

Receive param object for JS injected into every frame of the page crawled that sets up out link collection

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

OnNewDocumentInject | OnLoadInject

Object keyed for the params used by the desired CDP method

See:

public static getCrawlInjects(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject source

JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap, JS that scrolls the page automatically and JS that sets up out link collection

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

OnNewDocumentInject | OnLoadInject

Object keyed for the params used by the desired CDP method

See:

public static getCrawlInjectsNoScroll(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject source

Receive param object for JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap and JS that sets up out link collection

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

OnNewDocumentInject | OnLoadInject

Object keyed for the params used by the desired CDP method

See:

public static getNoNaughtyJsInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject source

Receive param object for JS injected into every frame of the page crawled that includes disabling things that can act as an crawler trap

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

OnNewDocumentInject | OnLoadInject

Object keyed for the params used by the desired CDP method

See:

public static getScollOnLoadInject(onNewDocument: boolean): {"key": *} source

Receive param object for JS injected into every frame of the page crawled that scrolls the page once the load event has fired

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

{"key": *}

See:

public static getScrollInject(onNewDocument: boolean): OnNewDocumentInject | OnLoadInject source

Receive param object for JS injected into every frame of the page crawled that scrolls the page automatically

Params:

NameTypeAttributeDescription
onNewDocument boolean
  • optional
  • default: true

Flag indicating if the inject object is for Page.addScriptToEvaluateOnNewDocument (default) or Page.addScriptToEvaluateOnLoad params

Return:

OnNewDocumentInject | OnLoadInject

Object keyed for the params used by the desired CDP method

See:

public static rawCollectInject(): collect source

Receive the raw function that is used to collect outlinks from the pre-injected script collect for use with Runtime.evaluate

Return:

collect

See:

public static rawNoNaughty(): function(): void source

Receive the raw function that helps ensure that the pages JS can not be naughty for use with Runtime.evaluate

Return:

function(): void

See:

Receive the raw function that is used to collect outlines from each of the pages frames. Used by PuppeteerCrawler

Return:

outLinks

public static rawScoll(): scrollPage source

Receive the raw scroll page function for use with Runtime.evaluate

Return:

scrollPage

See: