修改爬虫

This commit is contained in:
编码猿
2024-11-22 12:31:44 +08:00
parent 07c46ac300
commit 8fdd65b9bb
11 changed files with 2551 additions and 2 deletions

19
newBackApi/utils/crawl.js Normal file
View 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
View 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()