@brightdata/n8n-nodes-brightdata
Version:
Bright Data service for scraping purposes in n8n
47 lines • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getActiveZones = getActiveZones;
exports.getCountries = getCountries;
exports.getDataSets = getDataSets;
async function getActiveZones() {
const responseData = await this.helpers.requestWithAuthentication.call(this, 'brightdataApi', {
method: 'GET',
url: 'https://api.brightdata.com/zone/get_active_zones',
json: true,
});
const results = responseData.map((item) => ({
name: item.name,
value: item.name,
type: item.type,
}));
return { results };
}
async function getCountries() {
const responseData = await this.helpers.requestWithAuthentication.call(this, 'brightdataApi', {
method: 'GET',
url: 'https://api.brightdata.com/countrieslist',
json: true,
});
const results = responseData.zone_type.DC_shared.country_codes.map((code) => ({
name: code,
value: code,
type: 'DC_shared',
}));
results.sort((a, b) => a.name.localeCompare(b.name));
return { results };
}
async function getDataSets() {
const responseData = await this.helpers.requestWithAuthentication.call(this, 'brightdataApi', {
method: 'GET',
url: 'https://api.brightdata.com/datasets/list',
json: true,
});
const results = responseData.map((item) => ({
name: item.name,
value: item.id,
type: item.id,
}));
results.sort((a, b) => a.name.localeCompare(b.name));
return { results };
}
//# sourceMappingURL=SearchFunctions.js.map