'init'
This commit is contained in:
17
localAPI-main/js-examples/example-check-profile-status.js
Normal file
17
localAPI-main/js-examples/example-check-profile-status.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const profileId = 'XX';
|
||||
|
||||
const config = {
|
||||
method: 'get',
|
||||
url: `http://localhost:50325/api/v1/browser/active?user_id=${profileId}`,
|
||||
headers: { }
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
21
localAPI-main/js-examples/example-create-group.js
Normal file
21
localAPI-main/js-examples/example-create-group.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const axios = require('axios');
|
||||
const data = {
|
||||
group_name: "your_group_name"
|
||||
};
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: 'http://local.adspower.net:50325/api/v1/group/create',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
48
localAPI-main/js-examples/example-create-profile.js
Normal file
48
localAPI-main/js-examples/example-create-profile.js
Normal file
@@ -0,0 +1,48 @@
|
||||
var axios = require('axios');
|
||||
var data = {
|
||||
"name": "test",
|
||||
"group_id": "0",
|
||||
"domain_name": "facebook.com",
|
||||
"repeat_config": [
|
||||
"0"
|
||||
],
|
||||
"country": "us",
|
||||
"fingerprint_config": {
|
||||
"language": [
|
||||
"en-US"
|
||||
],
|
||||
"ua": "Mozilla/5.0 (Linux; Android 8.0.0; BND-AL10 Build/HONORBND-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/63.0.3239.83 Mobile Safari/537.36 T7/11.5 baiduboxapp/11.5.0.10 (Baidu; P1 8.0.0)",
|
||||
"flash": "block",
|
||||
"scan_port_type": "1",
|
||||
"screen_resolution": "1024_600",
|
||||
"fonts": [
|
||||
"all"
|
||||
],
|
||||
"longitude": "180",
|
||||
"latitude": "90",
|
||||
"webrtc": "proxy",
|
||||
"do_not_track": "true",
|
||||
"hardware_concurrency": "default",
|
||||
"device_memory": "default"
|
||||
},
|
||||
"user_proxy_config": {
|
||||
"proxy_soft": "no_proxy"
|
||||
}
|
||||
};
|
||||
|
||||
var config = {
|
||||
method: 'post',
|
||||
url: 'http://local.adspower.net:50325/api/v1/user/create',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
15
localAPI-main/js-examples/example-delete-profile-cache.js
Normal file
15
localAPI-main/js-examples/example-delete-profile-cache.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: 'http://localhost:50325/api/v1/user/delete-cache',
|
||||
headers: { }
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
23
localAPI-main/js-examples/example-delete-profile.js
Normal file
23
localAPI-main/js-examples/example-delete-profile.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const axios = require('axios');
|
||||
const data = {
|
||||
"user_ids": [
|
||||
"XX"
|
||||
]
|
||||
};
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: 'http://localhost:50325/api/v1/user/delete',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
15
localAPI-main/js-examples/example-query-group.js
Normal file
15
localAPI-main/js-examples/example-query-group.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const config = {
|
||||
method: 'get',
|
||||
url: 'http://local.adspower.net:50325/api/v1/group/list?page=1&page_size=15',
|
||||
headers: { }
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
15
localAPI-main/js-examples/example-query-profile.js
Normal file
15
localAPI-main/js-examples/example-query-profile.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const config = {
|
||||
method: 'get',
|
||||
url: 'http://local.adspower.net:50325/api/v1/user/list?page=1&page_size=100',
|
||||
headers: { }
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
24
localAPI-main/js-examples/example-regroup-profile.js
Normal file
24
localAPI-main/js-examples/example-regroup-profile.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const axios = require('axios');
|
||||
const data = {
|
||||
"user_ids": [
|
||||
"XX"
|
||||
],
|
||||
"group_id": "0"
|
||||
};
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: 'http://local.adspower.net:50325/api/v1/user/regroup',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
27
localAPI-main/js-examples/example-start-profile.js
Normal file
27
localAPI-main/js-examples/example-start-profile.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const axios = require('axios');
|
||||
const puppeteer = require('puppeteer-core');
|
||||
|
||||
const profileId = 'XXX';
|
||||
|
||||
// http://local.adspower.net:50325: Script can go to Profile Management-> click Settings-> click Cache folder-> local_api file to obtain API address
|
||||
axios.get(`http://local.adspower.net:50325/api/v1/browser/start?user_id=${profileId}`).then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
if(res.data.code === 0 && res.data.data.ws && res.data.data.ws.puppeteer) {
|
||||
try{
|
||||
const browser = await puppeteer.connect({
|
||||
browserWSEndpoint: res.data.data.ws.puppeteer,
|
||||
defaultViewport:null
|
||||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://www.adspower.com');
|
||||
await page.screenshot({ path: './adspower.png' });
|
||||
await browser.close();
|
||||
} catch(err){
|
||||
console.log(err.message);
|
||||
}
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
16
localAPI-main/js-examples/example-stop-profile.js
Normal file
16
localAPI-main/js-examples/example-stop-profile.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const profileId = 'XX';
|
||||
const config = {
|
||||
method: 'get',
|
||||
url: `http://local.adspower.net:50325/api/v1/browser/stop?user_id=${profileId}`,
|
||||
headers: { }
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
41
localAPI-main/js-examples/example-update-profile.js
Normal file
41
localAPI-main/js-examples/example-update-profile.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const axios = require('axios');
|
||||
const data = {
|
||||
"user_id": "XX",
|
||||
"name": "test",
|
||||
"domain_name": "facebook.com",
|
||||
"repeat_config": [
|
||||
"0"
|
||||
],
|
||||
"open_urls": [
|
||||
"http://www.baidu.com",
|
||||
"https://www.google.com"
|
||||
],
|
||||
"country": "us",
|
||||
"remark": "remark",
|
||||
"fingerprint_config": {
|
||||
"webrtc": "proxy",
|
||||
"do_not_track": "true",
|
||||
"hardware_concurrency": "default",
|
||||
"device_memory": "default"
|
||||
},
|
||||
"user_proxy_config": {
|
||||
"proxy_soft": "no_proxy"
|
||||
}
|
||||
};
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: 'http://local.adspower.net:50325/api/v1/user/update',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data : data
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then(function (response) {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
Reference in New Issue
Block a user