mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-03 16:34:07 +08:00
sync
This commit is contained in:
@@ -3,6 +3,7 @@ import {Md5} from "ts-md5"
|
||||
import * as dotenv from "dotenv"
|
||||
import {existsSync, readFileSync} from "fs"
|
||||
import {sendNotify} from './sendNotify'
|
||||
import {rejects} from "assert";
|
||||
|
||||
dotenv.config()
|
||||
|
||||
@@ -56,6 +57,7 @@ function TotalBean(cookie: string) {
|
||||
}
|
||||
|
||||
function getRandomNumberByRange(start: number, end: number) {
|
||||
end <= start && (end = start + 100)
|
||||
return Math.floor(Math.random() * (end - start) + start)
|
||||
}
|
||||
|
||||
@@ -340,31 +342,39 @@ async function jdpingou() {
|
||||
return `jdpingou;iPhone;5.19.0;${version};${randomString(40)};network/wifi;model/${device};appBuild/100833;ADID/;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/${getRandomNumberByRange(10, 90)};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
|
||||
}
|
||||
|
||||
function get(url: string, prarms?: string, headers?: any) {
|
||||
return axios.get(url, {
|
||||
params: prarms,
|
||||
headers: headers
|
||||
})
|
||||
.then(res => {
|
||||
if (typeof res.data === 'string' && res.data.match(/^jsonpCBK/)) {
|
||||
return JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);/)[1])
|
||||
function get(url: string, prarms?: string, headers?: any): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(url, {
|
||||
params: prarms,
|
||||
headers: headers
|
||||
}).then(res => {
|
||||
if (typeof res.data === 'string' && res.data.includes('jsonpCBK')) {
|
||||
resolve(JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);?/)[1]))
|
||||
} else {
|
||||
return res.data
|
||||
resolve(res.data)
|
||||
}
|
||||
}).catch(err => {
|
||||
reject({
|
||||
code: err?.response?.status || -1,
|
||||
msg: err?.response?.statusText || err.message || 'error'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err?.response?.status, err?.response?.statusText)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function post(url: string, prarms?: string | object, headers?: any): Promise<any> {
|
||||
return axios.post(url, prarms, {
|
||||
headers: headers
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(url, prarms, {
|
||||
headers: headers
|
||||
}).then(res => {
|
||||
resolve(res.data)
|
||||
}).catch(err => {
|
||||
reject({
|
||||
code: err?.response?.status || -1,
|
||||
msg: err?.response?.statusText || err.message || 'error'
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(res => res.data)
|
||||
.catch(err => {
|
||||
console.log(err?.response?.status, err?.response?.statusText)
|
||||
});
|
||||
}
|
||||
|
||||
export default USER_AGENT
|
||||
|
||||
Reference in New Issue
Block a user