修改爬虫
This commit is contained in:
19
newBackApi/utils/crawl.js
Normal file
19
newBackApi/utils/crawl.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { createCrawl } from 'x-crawl'
|
||||
|
||||
export class Crawl {
|
||||
|
||||
constructor(option) {
|
||||
this.app = createCrawl(option)
|
||||
}
|
||||
|
||||
|
||||
async page(url) {
|
||||
let { data } = await this.app.crawlPage(url)
|
||||
return data
|
||||
}
|
||||
|
||||
async html(url) {
|
||||
let { data } = await this.app.crawlHTML(url)
|
||||
return data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user