proxy-rotator-js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,20 +9,14 @@ ProxyRotator is a JavaScript class that provides a mechanism for managing a pool
|
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
```
|
|
12
|
-
npm install proxy-rotator
|
|
12
|
+
npm install proxy-rotator-js
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
pool: Represents the pool of proxies as a queue.
|
|
18
|
-
|
|
19
|
-
graveyard: Stores proxies that are currently dead or inactive.
|
|
20
|
-
|
|
21
15
|
## Usage
|
|
22
16
|
|
|
23
17
|
```javascript
|
|
24
18
|
|
|
25
|
-
import
|
|
19
|
+
import ProxyRotator from 'proxy-rotator-js'
|
|
26
20
|
|
|
27
21
|
let proxies = ['proxy1', 'proxy2', 'proxy3']
|
|
28
22
|
|
|
@@ -32,6 +26,22 @@ console.log( rotator.next() ) // 'proxy1'
|
|
|
32
26
|
console.log( rotator.next() ) // 'proxy2'
|
|
33
27
|
```
|
|
34
28
|
|
|
29
|
+
or you can pass the path to a proxy file
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
|
|
33
|
+
import ProxyRotator from 'proxy-rotator-js'
|
|
34
|
+
|
|
35
|
+
let filename = '/path/to/proxy/file.txt'
|
|
36
|
+
|
|
37
|
+
let rotator = new ProxyRotator(filename, options={});
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
console.log( rotator.next() ) // 'proxy1'
|
|
41
|
+
console.log( rotator.next() ) // 'proxy2'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
35
45
|
Initializes a new instance of ProxyRotator with the given proxies and options. The proxies parameter can be a file path or an array of proxies. The options parameter allows customization of various settings such as revive timer, shuffling, protocol assumption, and more.
|
|
36
46
|
Methods
|
|
37
47
|
|
|
@@ -61,6 +71,12 @@ getGraveyardSize() // Returns the number of proxies in the graveyard.
|
|
|
61
71
|
remove(proxy) // Removes one or more proxies from the pool.
|
|
62
72
|
```
|
|
63
73
|
|
|
74
|
+
## Properties
|
|
75
|
+
|
|
76
|
+
pool: Represents the pool of proxies as a queue.
|
|
77
|
+
|
|
78
|
+
graveyard: Stores proxies that are currently dead or inactive.
|
|
79
|
+
|
|
64
80
|
## Getting Started
|
|
65
81
|
|
|
66
82
|
To use the ProxyRotator class in your JavaScript project, follow these steps:
|
|
@@ -68,16 +84,11 @@ To use the ProxyRotator class in your JavaScript project, follow these steps:
|
|
|
68
84
|
Make sure you have Node.js and npm installed on your system.
|
|
69
85
|
|
|
70
86
|
```javascript
|
|
71
|
-
npm install proxy-rotator
|
|
87
|
+
npm install proxy-rotator-js
|
|
72
88
|
```
|
|
73
89
|
|
|
74
90
|
Import the ProxyRotator class into your JavaScript file using the following line of code:
|
|
75
91
|
|
|
76
|
-
```javascript
|
|
77
|
-
|
|
78
|
-
import ProxyRotator from './ProxyRotator.js';
|
|
79
|
-
```
|
|
80
|
-
|
|
81
92
|
Create an instance of ProxyRotator by calling the constructor and providing the required parameters. For example:
|
|
82
93
|
|
|
83
94
|
```javascript
|