This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
portapy/util/getpythonversions.js

23 lines
438 B
JavaScript
Raw Permalink Normal View History

2018-10-30 21:42:14 -04:00
module.exports = {
versions
}
const request = require('request');
2018-11-21 20:42:39 -05:00
// let matches = [];
let versions = function() {
new Promise(resolve => {
2018-10-30 21:42:14 -04:00
request({
uri: "https://www.python.org/ftp/python/",
}, function (error, response, body) {
const re = /"[0-9]{1,}\.[0-9]{1,}(\.[0-9]{1,})*\/"/g;
2018-11-21 20:42:39 -05:00
matches = body.match(re)
2018-10-30 21:42:14 -04:00
matches = matches.map((value) => {
2018-11-21 20:42:39 -05:00
return value.slice(1, -2);
2018-10-30 21:42:14 -04:00
});
2018-11-21 20:42:39 -05:00
resolve(matches);
2018-10-30 21:42:14 -04:00
});
})
2018-11-21 20:42:39 -05:00
}