-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-proxy.js
More file actions
79 lines (67 loc) · 2.41 KB
/
Copy pathtest-proxy.js
File metadata and controls
79 lines (67 loc) · 2.41 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
// Add stealth plugin
puppeteer.use(StealthPlugin());
async function testProxy() {
console.log('🔍 Тестирование прокси с Puppeteer...');
try {
// Тестируем без прокси
console.log('1. Тест без прокси:');
const browser1 = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage'
]
});
const page1 = await browser1.newPage();
await page1.goto('https://httpbin.org/ip', { timeout: 30000 });
const content1 = await page1.content();
console.log('Без прокси:', content1.substring(0, 200));
await browser1.close();
// Тестируем с прокси
console.log('\n2. Тест с HTTP прокси:');
const browser2 = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--proxy-server=http://qqfL1uPu:WcGxxjVf@166.1.118.214:63574'
]
});
const page2 = await browser2.newPage();
await page2.goto('https://httpbin.org/ip', { timeout: 30000 });
const content2 = await page2.content();
console.log('С прокси:', content2.substring(0, 200));
await browser2.close();
// Тестируем pump.fun
console.log('\n3. Тест pump.fun с прокси:');
const browser3 = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--proxy-server=http://qqfL1uPu:WcGxxjVf@166.1.118.214:63574'
]
});
const page3 = await browser3.newPage();
page3.on('error', (error) => {
console.log('Page error:', error.message);
});
page3.on('pageerror', (error) => {
console.log('Page script error:', error.message);
});
const response = await page3.goto('https://pump.fun', { timeout: 30000 });
console.log('Status код:', response.status());
console.log('URL:', page3.url());
console.log('Title:', await page3.title());
await browser3.close();
console.log('\n✅ Все тесты завершены!');
} catch (error) {
console.error('❌ Ошибка:', error.message);
}
}
testProxy();