File size: 807 Bytes
ec4bf22 4d4616f ec4bf22 4d4616f ec4bf22 4d4616f ec4bf22 4d4616f ec4bf22 4d4616f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { ProxyConfiguration } from 'crawlee';
// Dataify 动态住宅代理配置
const PROXY_HOST = 'eu.dataify.top';
const PROXY_PORT = '6600';
const PROXY_USERNAME = 'gqFOVXhf9yd2-r-de';
const PROXY_PASSWORD = 'm9E0BDFM';
// 创建代理URL
function getProxyUrl(): string {
return `https://${PROXY_USERNAME}:${PROXY_PASSWORD}@${PROXY_HOST}:${PROXY_PORT}`;
}
// 创建代理配置(Dataify 动态代理,每次请求自动轮换IP)
export function createProxyConfiguration(): ProxyConfiguration | undefined {
const proxyUrl = getProxyUrl();
console.log(`✅ 使用 Dataify 动态代理: ${PROXY_HOST}:${PROXY_PORT}`);
return new ProxyConfiguration({
proxyUrls: [proxyUrl],
});
}
// 保留向后兼容的函数
export function loadProxyUrls(): string[] {
return [getProxyUrl()];
}
|