Skip to content

crawlData

CrawlDataDetailTargetConfig

ts
export interface CrawlDataDetailTargetConfig extends CrawlCommonConfig {
  url: string
  method?: Method
  headers?: Object | null
  params?: Object
  data?: any
  priority?: number
  fingerprint?: DetailTargetFingerprintCommon | null
}
参数类型默认值描述
urlstring-url
methodMethodGET方法
headersObject | null-请求头
paramsIntervalTime-Query 参数
dataany-请求体
prioritynumber-优先级
fingerprintDetailTargetFingerprintCommon-设备指纹

CrawlDataAdvancedConfig

ts
export interface CrawlDataAdvancedConfig<T> extends CrawlCommonConfig {
  targets: (string | CrawlDataDetailTargetConfig)[]
  intervalTime?: IntervalTime
  fingerprints?: DetailTargetFingerprintCommon[]

  headers?: Object

  onCrawlItemComplete?: (
    crawlDataSingleResult: CrawlDataSingleResult<T>
  ) => void
}
参数类型默认值描述
targets(string | CrawlDataDetailTargetConfig)[]-目标
intervalTimeIntervalTime-间隔时间
fingerprintsDetailTargetFingerprintCommon[]-设备指纹
headersObject-请求头
onCrawlItemComplete( crawlDataSingleResult: CrawlDataSingleResult ) => void-声明周期

CrawlDataSingleResult

ts
export interface CrawlDataSingleResult<D> extends CrawlCommonResult {
  data: {
    statusCode: number | undefined
    headers: IncomingHttpHeaders // IncomingHttpHeaders 来自于 node:http
    data: D
  } | null
}

外部类型

  • IncomingHttpHeaders:来自于 nodejs 的 http

基于 MIT 许可发布