-
Notifications
You must be signed in to change notification settings - Fork 0
/
getProxyList.ts
45 lines (32 loc) · 1.47 KB
/
getProxyList.ts
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
export async function getProxyList(): Promise<string[]> {
let res1 = await fetch('https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt');
let text = await res1.text();
let list = text.split('\n');
let res2 = await fetch('https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=20000&country=all&ssl=no&anonymity=all')
let text2 = await res2.text();
let list2 = text.split('\n');
return list.concat(list2)
}
// console.log(await getProxyList())
// export function getProxyList1(): Promise<string[]> {
// let ip_addresses: string[] = [];
// let port_numbers: string[] = [];
// return new Promise(res => {
// request("https://sslproxies.org/", function (error, response, html) {
// if (!error && response.statusCode == 200) {
// const $ = cheerio.load(html);
// $("td:nth-child(1)").each(function (index, value) {
// ip_addresses[index] = $(this).text();
// });
// $("td:nth-child(2)").each(function (index, value) {
// port_numbers[index] = $(this).text();
// });
// } else {
// console.log("Error loading proxy, please try again");
// }
// ip_addresses.join(", ");
// port_numbers.join(", ");
// res(ip_addresses.map((addr, index) => `${addr}:${port_numbers[index]}`))
// });
// });
// }