Created
January 30, 2019 16:26
-
-
Save VitalyKondratiev/379216893fd33dcdc87152463a384fbe to your computer and use it in GitHub Desktop.
Getting list of working proxies on Node.js (node module, promise)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const osmosis = require('osmosis'); | |
module.exports = function () { | |
return new Promise(function (resolve, reject) { | |
let proxies = []; | |
osmosis | |
.get('https://free-proxy-list.com/?search=1&up_time=60') | |
.find('.proxy-list tbody tr td:first-child a') | |
.set({ 'data': '@title' }) | |
.error(error => reject(proxies)) | |
.data(data => proxies.push(data.data)) | |
.then(event => { | |
if (event.last) resolve(proxies); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment