修改爬虫
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
|
||||
}
|
||||
}
|
||||
12
newBackApi/utils/ip.js
Normal file
12
newBackApi/utils/ip.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import ip from 'ip'
|
||||
|
||||
class IP {
|
||||
ipv6() {
|
||||
return ip.address('private','ipv6')
|
||||
}
|
||||
ipv4() {
|
||||
return ip.address('public','ipv4')
|
||||
}
|
||||
}
|
||||
|
||||
export const {ipv6,ipv4} = new IP()
|
||||
Reference in New Issue
Block a user