w-ipproxy 1.0.1 → 1.0.2
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/.eslintrc.js +18 -17
- package/.github/workflows/ci-test.yml +2 -2
- package/README.md +64 -2
- package/babel.config.js +4 -2
- package/dist/w-ip-proxy.umd.js +7 -0
- package/dist/w-ip-proxy.umd.js.map +1 -0
- package/docs/WIpProxy.html +642 -0
- package/docs/WIpProxy.mjs.html +465 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +84 -0
- package/docs/scripts/collapse.js +39 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +99 -0
- package/docs/styles/jsdoc.css +776 -0
- package/docs/styles/prettify.css +80 -0
- package/g-getByTimer.mjs +24 -0
- package/g-getOnce.mjs +11 -0
- package/g-srv.mjs +28 -0
- package/package.json +11 -9
- package/script.txt +17 -0
- package/src/WIpProxy.mjs +384 -14
- package/src/provideServer.mjs +65 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/gDistRollup.mjs +29 -0
- package/toolg/modifyReadme.mjs +4 -0
- package/g.mjs +0 -12
- package/src/getHtml.mjs +0 -84
- package/src/getProxyListOrg.mjs +0 -66
- package/src/parseHtml.mjs +0 -19
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
|
|
2
|
+
import getFiles from 'w-package-tools/src/getFiles.mjs'
|
|
3
|
+
import w from 'wsemi'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
let fdSrc = './src'
|
|
7
|
+
let fdTar = './dist'
|
|
8
|
+
let fns = getFiles(fdSrc)
|
|
9
|
+
fns = fns.filter((v) => {
|
|
10
|
+
return w.strleft(v, 1) === 'W'
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
rollupFiles({
|
|
14
|
+
fns,
|
|
15
|
+
fdSrc,
|
|
16
|
+
fdTar,
|
|
17
|
+
nameDistType: 'kebabCase',
|
|
18
|
+
globals: {
|
|
19
|
+
'@hapi/hapi': '@hapi/hapi',
|
|
20
|
+
'@hapi/inert': '@hapi/inert',
|
|
21
|
+
'https': 'https',
|
|
22
|
+
},
|
|
23
|
+
external: [
|
|
24
|
+
'@hapi/hapi',
|
|
25
|
+
'@hapi/inert',
|
|
26
|
+
'https',
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
|
package/g.mjs
DELETED
package/src/getHtml.mjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
async function getHtml(url, selector, muti = false) {
|
|
5
|
-
|
|
6
|
-
async function view(url) {
|
|
7
|
-
|
|
8
|
-
//new page
|
|
9
|
-
let olaunch = {
|
|
10
|
-
//timeout: 0,
|
|
11
|
-
headless: false,
|
|
12
|
-
slowMo: 20,
|
|
13
|
-
// arg: [
|
|
14
|
-
// //`--window-size=${viewport.width},${viewport.height}`, //無效
|
|
15
|
-
// //`--disable-resize-lock`, //無效
|
|
16
|
-
// ],
|
|
17
|
-
// defaultViewport: { //無效
|
|
18
|
-
// x: 0,
|
|
19
|
-
// y: 0,
|
|
20
|
-
// width: 800,
|
|
21
|
-
// height: 600,
|
|
22
|
-
// }
|
|
23
|
-
}
|
|
24
|
-
let browser = await puppeteer.launch(olaunch)
|
|
25
|
-
let page = await browser.newPage()
|
|
26
|
-
|
|
27
|
-
//show page
|
|
28
|
-
await page.goto(url)
|
|
29
|
-
let viewport = {
|
|
30
|
-
x: 0,
|
|
31
|
-
y: 0,
|
|
32
|
-
width: 800,
|
|
33
|
-
height: 600,
|
|
34
|
-
}
|
|
35
|
-
await page.setViewport(viewport)
|
|
36
|
-
|
|
37
|
-
//wait
|
|
38
|
-
let waitsec = 5
|
|
39
|
-
await page.waitFor(waitsec * 1000)
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
browser,
|
|
43
|
-
page,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function close(p) {
|
|
48
|
-
|
|
49
|
-
//close
|
|
50
|
-
await p.page.close()
|
|
51
|
-
await p.browser.close()
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function g1(p, selector) {
|
|
56
|
-
return await p.page.$eval(selector, (node) => {
|
|
57
|
-
return node.innerHTML
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function gs(p, selector) {
|
|
62
|
-
return await p.page.$$eval(selector, (nodes) => {
|
|
63
|
-
return nodes.map((node) => {
|
|
64
|
-
return node.innerHTML
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let p = await view(url)
|
|
70
|
-
|
|
71
|
-
let r
|
|
72
|
-
if (muti) {
|
|
73
|
-
r = await gs(p, selector)
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
r = await g1(p, selector)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
close(p)
|
|
80
|
-
|
|
81
|
-
return r
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default getHtml
|
package/src/getProxyListOrg.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// import fs from 'fs'
|
|
2
|
-
import get from 'lodash/get'
|
|
3
|
-
import sep from 'wsemi/src/sep.mjs'
|
|
4
|
-
import pmMap from 'wsemi/src/pmMap.mjs'
|
|
5
|
-
import parseHtml from './parseHtml.mjs'
|
|
6
|
-
import getHtml from './getHtml.mjs'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
async function core(url) {
|
|
10
|
-
let ps = []
|
|
11
|
-
|
|
12
|
-
let selector = 'div.table'
|
|
13
|
-
let h = await getHtml(url, selector)
|
|
14
|
-
// fs.writeFileSync('temp.html', h)
|
|
15
|
-
// let h = fs.readFileSync('tempProxyListOrg.html', 'utf8')
|
|
16
|
-
|
|
17
|
-
//parseHtml
|
|
18
|
-
let $ = parseHtml(h)
|
|
19
|
-
$('ul').map((k, v) => {
|
|
20
|
-
let q = $(v)
|
|
21
|
-
|
|
22
|
-
let proxy = q.children('li.proxy').html()
|
|
23
|
-
proxy = sep(proxy, 'script>')
|
|
24
|
-
proxy = get(proxy, 1)
|
|
25
|
-
// console.log(k,'proxy',proxy)
|
|
26
|
-
|
|
27
|
-
let httpType = q.children('li.https').text()
|
|
28
|
-
// console.log(k,'httpType',httpType)
|
|
29
|
-
|
|
30
|
-
let country = q.find('span.country').text()
|
|
31
|
-
// console.log(k,'country',country)
|
|
32
|
-
|
|
33
|
-
let countryName = q.find('span.name').attr('name')
|
|
34
|
-
// console.log(k,'countryName',countryName)
|
|
35
|
-
|
|
36
|
-
ps.push({
|
|
37
|
-
proxy,
|
|
38
|
-
httpType,
|
|
39
|
-
country,
|
|
40
|
-
countryName,
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
return ps
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function getProxyListOrg() {
|
|
48
|
-
let psAll = []
|
|
49
|
-
|
|
50
|
-
await pmMap([1, 2, 3], async(v) => {
|
|
51
|
-
// console.log(v)
|
|
52
|
-
|
|
53
|
-
//url
|
|
54
|
-
//let url = 'https://proxy-list.org/chinese/index.php?setlang=chinese'
|
|
55
|
-
let url = `https://proxy-list.org/chinese/index.php?setlang=chinese&p=${v}`
|
|
56
|
-
|
|
57
|
-
//core
|
|
58
|
-
let ps = await core(url)
|
|
59
|
-
psAll = [...psAll, ...ps]
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return psAll
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default getProxyListOrg
|
package/src/parseHtml.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import cheerio from 'cheerio'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function parseHtml(h) {
|
|
6
|
-
|
|
7
|
-
let $setting = {
|
|
8
|
-
//ignoreWhitespace: true,
|
|
9
|
-
xmlMode: true,
|
|
10
|
-
decodeEntities: false,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//$
|
|
14
|
-
let $ = cheerio.load(h, $setting)
|
|
15
|
-
|
|
16
|
-
return $
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default parseHtml
|