-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathproxyhttp-net.js
71 lines (68 loc) · 1.41 KB
/
proxyhttp-net.js
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
'use strict';
var _ = require('underscore');
var convert = {
anonymityLevels: {
'transparent': 'transparent',
'anonymous': 'anonymous',
'high': 'elite',
},
protocols: {
'': ['https'],
'-': ['http'],
},
};
module.exports = {
homeUrl: 'https://proxyhttp.net/',
abstract: 'list-crawler',
defaultOptions: {
defaultTimeout: 5000,
},
config: {
lists: [{
link: {
url: 'https://proxyhttp.net/',
},
items: [{
selector: 'table.proxytbl tr:nth-child(n+2):not(:nth-last-child(1))',
attributes: [
{
name: 'ipAddress',
selector: 'td:nth-child(1)',
},
{
name: 'port',
selector: 'td:nth-child(2)',
parse: function(text) {
var match = text.trim().match(/[^0-9]([0-9]+)$/);
if (!match || !match[1]) return null;
var port = parseInt(match[1]);
if (_.isNaN(port)) return null;
return port;
},
},
{
name: 'anonymityLevel',
selector: 'td:nth-child(4)',
parse: function(text) {
if (!text) return null;
return convert.anonymityLevels[text.trim().toLowerCase()];
},
},
{
name: 'protocols',
selector: 'td:nth-child(5)',
parse: function(text) {
if (!text) return null;
return convert.protocols[text.trim().toLowerCase()];
},
},
],
}],
pagination: {
next: {
selector: '#pages a.current + a',
},
},
}],
},
};