File tree 3 files changed +144
-1
lines changed
3 files changed +144
-1
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = [
2
+ {
3
+ ip : '220.130.167.59' ,
4
+ port : '60498' ,
5
+ protocol : 'socks4'
6
+ } ,
7
+ {
8
+ ip : '59.124.170.47' ,
9
+ port : '60909' ,
10
+ protocol : 'socks4'
11
+ } ,
12
+ {
13
+ ip : '114.33.75.32' ,
14
+ port : '4145' ,
15
+ protocol : 'socks4'
16
+ } ,
17
+ {
18
+ ip : '122.117.159.191' ,
19
+ port : '4145' ,
20
+ protocol : 'socks4'
21
+ } ,
22
+ {
23
+ ip : '59.127.192.49' ,
24
+ port : '4145' ,
25
+ protocol : 'socks4'
26
+ } ,
27
+ {
28
+ ip : '114.35.0.142' ,
29
+ port : '1080' ,
30
+ protocol : 'socks4'
31
+ } ,
32
+ {
33
+ ip : '218.161.39.151' ,
34
+ port : '4145' ,
35
+ protocol : 'socks4'
36
+ } ,
37
+ {
38
+ ip : '210.61.216.66' ,
39
+ port : '33990' ,
40
+ protocol : 'socks4'
41
+ } ,
42
+ {
43
+ ip : '1.34.136.15' ,
44
+ port : '38318' ,
45
+ protocol : 'socks4'
46
+ } ,
47
+ {
48
+ ip : '220.133.57.116' ,
49
+ port : '40042' ,
50
+ protocol : 'socks4'
51
+ } ,
52
+ {
53
+ ip : '220.132.57.245' ,
54
+ port : '4145' ,
55
+ protocol : 'socks4'
56
+ } ,
57
+ {
58
+ ip : '114.35.75.39' ,
59
+ port : '36981' ,
60
+ protocol : 'socks4'
61
+ } ,
62
+ {
63
+ ip : '220.135.2.247' ,
64
+ port : '59171' ,
65
+ protocol : 'socks4'
66
+ } ,
67
+ {
68
+ ip : '114.35.188.117' ,
69
+ port : '4145' ,
70
+ protocol : 'socks4'
71
+ } ,
72
+ {
73
+ ip : '114.32.205.167' ,
74
+ port : '4145' ,
75
+ protocol : 'socks4'
76
+ } ,
77
+ {
78
+ ip : '1.163.59.146' ,
79
+ port : '4145' ,
80
+ protocol : 'socks4'
81
+ } ,
82
+ {
83
+ ip : '114.34.53.64' ,
84
+ port : '4145' ,
85
+ protocol : 'socks4'
86
+ } ,
87
+ {
88
+ ip : '1.34.1.60' ,
89
+ port : '51372' ,
90
+ protocol : 'socks4'
91
+ } ,
92
+ {
93
+ ip : '211.21.92.211' ,
94
+ port : '4145' ,
95
+ protocol : 'socks4'
96
+ } ,
97
+ {
98
+ ip : '114.34.178.70' ,
99
+ port : '39134' ,
100
+ protocol : 'socks4'
101
+ } ,
102
+ {
103
+ ip : '220.132.27.154' ,
104
+ port : '4145' ,
105
+ protocol : 'socks4'
106
+ } ,
107
+ {
108
+ ip : '1.34.146.163' ,
109
+ port : '54502' ,
110
+ protocol : 'socks4'
111
+ }
112
+ ]
Original file line number Diff line number Diff line change
1
+ const puppeteer = require ( 'puppeteer' )
2
+ const proxies = require ( '../proxies' )
3
+ const { urls } = require ( '../config' )
4
+
5
+ module . exports = async ( ) => {
6
+ for ( const proxy of proxies ) {
7
+ const { ip, port, protocol } = proxy
8
+ const uri = `${ protocol } ://${ ip } :${ port } `
9
+
10
+ const browser = await puppeteer . launch ( {
11
+ args : [
12
+ '--no-sandbox' ,
13
+ `--proxy-server=${ uri } `
14
+ ]
15
+ } )
16
+ const page = await browser . newPage ( )
17
+ try {
18
+ console . log ( `try to use proxy: ${ uri } successfully` )
19
+ await page . goto ( urls . pageLogin )
20
+ await browser . close ( )
21
+ console . log ( `proxy: ${ uri } is connectable` )
22
+ return uri
23
+ } catch ( error ) {
24
+ console . error ( `try to use proxy: ${ uri } fail` )
25
+ console . error ( error )
26
+ await browser . close ( )
27
+ }
28
+ }
29
+ }
Original file line number Diff line number Diff line change 1
1
const puppeteer = require ( 'puppeteer' )
2
2
const _shouldTodayPunch = require ( './shouldTodayPunch' )
3
+ const fetchAvalibleProxy = require ( './fetchAvalibleProxy' )
3
4
const {
4
5
urls,
5
6
selectors
@@ -35,12 +36,13 @@ const punch = async payload => {
35
36
const { action, name, id } = payload
36
37
console . log ( `${ name } /${ id } /punch-${ action } : Start punch ${ action } for ${ name } /${ id } ` )
37
38
39
+ const proxy = await fetchAvalibleProxy ( )
38
40
const browser = await puppeteer . launch ( {
39
41
headless : process . env . NODE_ENV !== 'development' ,
40
42
slowMo : process . env . NODE_ENV !== 'development' ? 0 : 250 ,
41
43
args : [
42
44
'--no-sandbox' ,
43
- ' --proxy-server=socks4://114.43.5.97:4145'
45
+ ` --proxy-server=${ proxy } `
44
46
]
45
47
} )
46
48
You can’t perform that action at this time.
0 commit comments